images in javascript

Results 1 to 2 of 2

Thread: images in javascript

  1. #1
    Join Date
    Dec 1969

    Default images in javascript

    everytime a page is loaded, this javascript code is executed (not inside a function).<BR><BR>var folder = new Image();<BR>folder.src = "images/folder.gif";<BR>var folder2 = new Image();<BR>folder2.src = "images/folder2.gif";<BR><BR>some images sometime change, with code similar to this (inside functions)<BR>document.images["img_lvl0-" + i].src = folder.src; <BR><BR>Now, this works fine for a while. But if you leave internet explorer 5.5 alone for a while and come back to it, the next time you want to change an image, it will be changed with a blank space. Gets me feeling that the image is downloaded into memory, stays there for a while, and because its currently unused, its deleted from memory. <BR><BR>How can I force it to not delete it from memory or make sure it downloads it again next time I change it?

  2. #2
    Join Date
    Dec 1969

    Default How about...

    &#060;IMG Name="folder" Src="folder.gif" style="visibility: hidden"&#062;<BR><BR>and then, instead of using <BR> folder.src <BR>to get the images later, you use <BR> document.images["folder"].src<BR><BR>Maybe?<BR><BR>(If I have the style for hiding the image wrong, you get to fix it. It&#039;s probably dependent on the browser, anyway.)<BR><BR>

Posting Permissions

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