Forum Moderators: open

Message Too Old, No Replies

MSIE7 Issue with InnerHTML

Converting HTML to Text

         

cabbagehead

11:53 pm on May 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Really wierd issues that I'm only seeing on MSIE7; Firefox looks fine: If I put a string of HTML into a variable and then set that variable as the innerHTML of a div, it works fine ... *unless* that variable just happens to have a " or ' or something like that in it. Case in point:

sharelayer="<a href=javascript:shareme('http://del.icio.us/post?url=')>";
document.getElementById(whichontab).innerHTML= sharelayer;

...when I do this, the HTML shows up correctly if I remove the single quotes around the URL. But of course if I do that then the Javascript won't interpret that String value properly.

And of course it all works fine on Firefox.

Any ideas?

Thanks.
Neal

cabbagehead

12:03 am on May 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm ... actually I just figured it out! lol.

.... turns out it is the specific combination of two sequential characters that is the issue: =' or =" ... in both these cases the HTML seems to escape in MSIE7 and become text. Lovely little 'feature' there. Is Microsoft hardcoding shortcut exceptions into their Javascript engine now? I'm seen something similar where I had URLs that had &section= in my URL being interpreted so that &sect was being treated as &sect; and it was screwing up my URL. I wonder how many of these there are. :(

mehh

6:55 pm on May 31, 2007 (gmt 0)

10+ Year Member



i think the standards say:
url.html?foo=bar&blah=random+text
should be written
url.html?foo=bar&amp;blah=random+text
so that may be why IE7 is fowling up on that