Jump to content

updating grafic


alin19

Recommended Posts

If you have a PHP script generating a graphic, and you refer to it like so:

 

<img id="random_pic" src="/images/random.php" />

 

You can update it with JavaScript like so:

 

<script>
function updateImage ( ) {
  var date = new Date;
  document.getElementById('random_pic').src = "/images/random.php?_="+date.getTime();
}
</script>
<img id="random_pic" src="/images/random.php" />
<input type="button" value="Update Image" onclick="updateImage();" />

Link to comment
https://forums.phpfreaks.com/topic/87817-updating-grafic/#findComment-449211
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.