Click to See Complete Forum and Search --> : reload picture


Bryan Tuffin
01-09-2003, 12:22 AM
Is there any way to reload a picture into the cache using javascript without refreshing the entire page.

Scriptage
01-09-2003, 02:49 AM
<img src="image.jpg" name="the_image" onClick="update(this.name)">
<script>
function update(name){
document.images[name].src=document.images[name].src;
}
</script>

This will reload the picture when it is clicked.

Basically the name of the image is passed to the function update, the image that was passed to update is then updated.

gil davis
01-09-2003, 05:46 AM
This will load an image. If it is already in cache, it will only get it from the cache. I don't know of a way to force an image to refresh.

<script>
var tmp = new Image();
tmp.src = "someimage.gif";
</script>