Re: odd problem about innerHTML & img under IE
- From: Thomas 'PointedEars' Lahn <PointedEars@xxxxxx>
- Date: Fri, 30 Nov 2007 22:15:25 +0100
chunghe@xxxxxxxxx wrote:
I made a simple demo below, click the button will trigger show( )
function, which insert image node to a DIV using innerHTML
( pl.innerHTML += '<IMG SRC=" + url[i] + ">'; ), it works fine under
FF but under IE6, no images displayed at all.
Use standardized W3C DOM creator and mutator methods instead of the
proprietary `innerHTML' property. It will save you a lot of trouble.
http://www.w3.org/TR/DOM-Level-3-Core/
[...]
My question is why the image didn't display and how to make this
example work under IE6.
[...]
http://kitty.2y.idv.tw/~chfang/test.htm
I see five broken images in "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10".
Probably you have a caching problem. Try Ctrl/Command+Shift+R or Ctrl+F5 in
both UAs.
[...]
<a href="javascript:void(0)" onclick="show()">show</a>
<script type="text/javascript">
document.write('<a href="#" onclick="show(); return false;">show<\/a>');
</script>
The rest of your markup is not at all Valid, so any observed malfunction is
not surprising. You should apply http://validator.w3.org/ to it, and make
the required modifications.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7@xxxxxxxxxxxxxxxx>
.
- References:
- odd problem about innerHTML & img under IE
- From: chunghe
- odd problem about innerHTML & img under IE
- Prev by Date: Re: Accessing an object name
- Next by Date: Re: odd problem about innerHTML & img under IE
- Previous by thread: odd problem about innerHTML & img under IE
- Next by thread: Re: odd problem about innerHTML & img under IE
- Index(es):