JavaScript preloaded images are loading

I preload the images via JS like this:

Image1= new Image(234,273)
Image1.src = "001.png"

Images are successfully called when the page loads (confirmed from the Firebug Net panel).

After that, there is a button that launches a function that replaces the image as follows:

document.getElementById("myImage").src = "001.png";

The problem is that when this function is called reloading the 001.png file, even if it was downloaded earlier.

Any ideas on why he is doing this / how to avoid it?

+1
source share

All Articles