Hi,
I have got a script to refresh a single image but I want the user to be able to change the refresh rate of the picture by clicking a link. I have tryed the following code:

<p><IMG src="http://rc-xbot.ath.cx/webcam.jpg" width="320" height="240" border="1" name="refresh">
  <SCRIPT language="JavaScript" type="text/javascript">
      <!--
	  function Change(t) {
	  var t = 2
      image = "http://rc-xbot.ath.cx/webcam.jpg"
      function Start() {
      tmp = new Date();
      tmp = "?"+tmp.getTime()
      document.images["refresh"].src = image+tmp
      setTimeout("Start()", t*1000)
      }
      Start();
	  }
      // -->
      </SCRIPT>
</p>
<p><a href="javascript:Change('2')">2</a> <a href="javascript:Change('10')">10</a></p>

But that refreshes the image once when the user clicks on the link.
Thanx in advance
Sam Rudge

setTimeout executes a given piece of code / a function after a given amount of time, though not repeatedly. For that, there is always setInterval.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.