|
Mailing Lists
|
Home /
Groups /
Javascript
Does the IE interpreter multitask?
Hi all,Dan K 07/30/07 08:08 P Remember that browsers interpret your html slightly different thus whenBader, Terrence C CTR MARMC, 231 07/31/07 09:17 A Hi all, Forgive my unfamiliarity with IE's engine (or for that matter javascript), but I was hoping I could find some answers more easily here. I am testing a web page with two browsers: IE v7.0.5730 and Firefox v2.0.0.5, and (surprise!) IE is giving me grief. Here is the code that my IE debugger claims is a runtime error (s is a string): document.getElementById("Container").innerHTML += s; I am skeptical that this is the true source of the problem since a simple ammendment to a document object shouldn't throw off IE (this code works just fine in Firefox). Interestingly, when I query as to the length of the element with id "Container" right before the above call: alert(document.getElementById("Container").innerHTML.length); I invariably get two different numbers (13641 in IE, 13931 in FF). The only time the innerHTML of this object is modified is when it is initialized, which is called in a function that precedes the function that has the runtime error script. Heres to clarify: addCategories(); /*function that defines the innerHTML of the object*/ addPrinciples(); /*function that ammends to the innerHTML and 'causes' the error*/ Could the error come from the order in which IE executes js? Any speculation on this problem would be greatly appreciated!!! Remember that browsers interpret your html slightly different thus when you load a page what happens is that the html is formatted by that browsers engine. Not knowing all the specifics you can imagine that they each have their own interpretation and format things differently. This is then what is used to determine the length of innerHtml and why you get different answers. To test this you could write some code, load it and then post the innerHtml in both browsers and see what the different is. Have you tried doing this: var newText = document.getElementById("Container").innerHTML + s; document.getElementById("Container").innerHTML = newText; ?? += should work but try it and see.... Also you cannot write to innerHTML while the document is still loading (use HTMLDocument.write()). So questions that remain are, what is all the code and what are you trying to do? ~Terry Hi all, Forgive my unfamiliarity with IE's engine (or for that matter javascript), but I was hoping I could find some answers more easily here. I am testing a web page with two browsers: IE v7.0.5730 and Firefox v2.0.0.5, and (surprise!) IE is giving me grief. Here is the code that my IE debugger claims is a runtime error (s is a string): document.getElementById("Container").innerHTML += s; I am skeptical that this is the true source of the problem since a simple ammendment to a document object shouldn't throw off IE (this code works just fine in Firefox). Interestingly, when I query as to the length of the element with id "Container" right before the above call: alert(document.getElementById("Container").innerHTML.length); I invariably get two different numbers (13641 in IE, 13931 in FF). The only time the innerHTML of this object is modified is when it is initialized, which is called in a function that precedes the function that has the runtime error script. Heres to clarify: addCategories(); /*function that defines the innerHTML of the object*/ addPrinciples(); /*function that ammends to the innerHTML and 'causes' the error*/ Could the error come from the order in which IE executes js? Any speculation on this problem would be greatly appreciated!!!
|
May 20, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||