<script> generate tag using createElement IE issue
I am running some javascript that i include on the page using script include and within this script I generate another script tag that references a dynamic php file that returns javascript.
The javascript that is returned is a json object that i use in the actual javascript file that has been included on the webpage.
for example:
script 1 generates script 2 but script 1 relies on json object in script 2.
In script 2 i generate a json object - echo "var jsonobj = ".$jsonobj;
and in script 1 i pick up this javascript object.
Problem is IE does not find jsonobj it is undefined or null where as in Firefox i can use the object and all is great.
What I want to know is, is this technique not valid in IE or am i doing something wrong?
Let me know if this is not clear.
webwiz posted this at 22:29 — 15th July 2009.
He has: 629 posts
Joined: May 2007
Does this help, from the MSDN documentation for CreateElement?
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
benf posted this at 18:25 — 17th July 2009.
They have: 426 posts
Joined: Feb 2005
hi webwiz, that is what I am doing. I have a function that generates the element and appends to the body tag?
webwiz posted this at 19:30 — 17th July 2009.
He has: 629 posts
Joined: May 2007
Kinda hard to debug 'blind'. Do you have a link to your page?
#1 sticky on this forum!
benf posted this at 18:56 — 21st July 2009.
They have: 426 posts
Joined: Feb 2005
I made a fix by using document.write to add the rather than using appendChild.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.