A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Images not showing up in ie when i use innerHTML to insert them after page load.

  1. #1
    Senior Member
    Join Date
    Sep 2000

    Images not showing up in ie when i use innerHTML to insert them after page load.

    Hi yah, I'm totally racking my brain here so any help is greatly appreciated.
    Basically I just want to be able to insert an image into a page after its been loaded, through a javascript call. I have it working fine in every browser ive tested except windows IE. If i call the script onLoad in the body tag the image works, but if i call it by clicking the links the image never loads. If i first go to the image directly and it gets loaded in the cache then everything works. So it seems like ie is just not loading it when i try to insert it after the page loads.
    Additionally I can't preload these images, and they must be loaded only when the function "doIt" is called and that needs to be able to happen after the page loads.
    Im currently just loading a random image off the web for testing.

    Here is the code im using.
    the javascript...
    function doIt(){
    var test = document.getElementById("test2");
    test.innerHTML = "<img src='http://www.blogwithoutalibrary.net/images/googlehomepage.jpg' />";
    function undoIt(){
    var test = document.getElementById("test2");
    test.innerHTML = "";
    in the html...
    <div id="test2"></div>
    <a href="javascript:;" onclick="doIt()">link</a>
    <a href="javascript:;" onclick="undoIt()">link</a>

  2. #2
    Junior Member
    Join Date
    Jan 2008
    Dear 0Knowledge,
    I am experiencing the same problem that you explain, did you find a solution to it?

    Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center