Web Analytics Made Easy -
StatCounter Webcam refresh script... - CodingForum

Announcement

Collapse
No announcement yet.

Webcam refresh script...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webcam refresh script...

    I was given this bit of code:

    Code:
    <img src="current.jpg" name="refresh" width="306" height="408"> 
          <script language="JavaScript" type="text/javascript"> 
          <!-- 
          image = "current.jpg" //name of the image 
          function Reload() { 
          tmp = new Date(); 
          tmp = "?"+tmp.getTime() 
          document.images["refresh"].src = image+tmp 
          setTimeout("Reload()",1000) 
          } 
          Reload(); 
    
          // --> 
          </script>
    to refresh a webcam image. I want to know what it means--how often is it set to refresh? I don't know javascript so I can't tell. Is it set to refresh whenever the image is new? or what? I would like to move away from my meta-refresh page-in-an-iframe method of refreshing my webcam if I can. My cam uploads a new image every 5 seconds. I need code that would allow the new image to be seen. Will this code do it? I tried it and it doesn't seem to refresh that often. So what does it do, and can it be tweaked?

  • #2
    The refresh interval is set here:

    Code:
    setTimeout("Reload()",1000)
    That is in "ms" and not regular seconds so divide the number by 1000 to get seconds.

    Basically, it refreshes once per second. To get a 5-second refresh just change 1000 to 5000.

    Comment

    Working...
    X