[thelist] image refresh not page refresh

Joshua Olson joshua at waetech.com
Thu Jan 15 01:43:10 CST 2004


----- Original Message ----- 
From: "John C Bullas" <jcbullas at nildram.co.uk>
Sent: Thursday, January 15, 2004 2:33 AM


> <meta http-Equiv="refresh" content="30">
>
> to refresh the whole page to catch up with new images uploaded while a
page
> is viewed
> HOWEVER to use a hit log on the page I wouldd like to refresh the image
> leaving the page un-reloaded (!)
>
> if there some tag that can be appended to an image tag to get it to
reload?

John,

If I understand you correctly, you wish to reload just an image on a page
every few (perhaps 30) seconds?  If so, your best bet is to use JavaScript.

SetInterval will allow you to create a block of code that execute every x
milliseconds.

Example:

setInterval('reloadImage()', 30000);  // 30 seconds

Then, the reloadImage should replace the image thusly:

function reloadImage()
{
  img = document.getElementById('theimage');
  img.src = '/path/to/the/image/theimage.jpg?' + Math.random();
}

The Math.random() appended to the end of the image filename ensure that the
browser will reload the image.

HTH,

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168



More information about the thelist mailing list