Announcement

Collapse
No announcement yet.

javascript help please

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

  • javascript help please

    How can I get this javascript to work?

    I have this script that refreshs my webcam... but when I try to integrate it into vb it wont refresh... and ideas? thanks.

  • #2
    You'd have to give us a little more info to go on.
    If you posted the script, we could take a look at it.

    Comment


    • #3
      Originally posted by vBR
      You'd have to give us a little more info to go on.
      If you posted the script, we could take a look at it.

      this goes in the header include

      Code:
      <SCRIPT LANGUAGE="JavaScript">
      <!-- hide
      // browser sniffer:
      browserVer = parseInt(navigator.appVersion);
      if (navigator.appName == "Microsoft Internet Explorer" && browserVer < 4)
      {
      alert("Internet Explorer 3 users need to hit 'Refesh' to update the image");
      }
      //this eliminates JavaScript error messages
      onError=null
      // The variables you need to change are: the filename of the picture,
      // the refresh rate, the expected time to download and further down,
      // the FORM ACTION (look for the ***).
      var picname = "webcam32.jpg";  // set this to the filename of your campicture
      var speed = 10;  // "var speed" is the refresh rate adjustment in seconds
      var y = 5;      // expected time to download the picture file. It  MUST be
                       // set at a smaller number than the "speed" variable!
      var x = speed;   // current countdown
      var cachepic = new Image();
      // Change "JSCamRemote.html" to whatever you want to call the page that 
      // opens in the remote window. 
      function openremoteWindow()
       {
       stopClock();
       open ("JSCamRemote.html","JSCamRemote", "height=310,width=340,scrollbars=0,resizable=yes,status=0")
       }
      function stopClock() {
       x = "00";
       document.form0.clock.value = x;
      }
      function startClock() {
              if (x != "00") {
       x = x - 1;
       document.form0.clock.value = x;
               if (x == y) {
                recache()
              }
       if (x <= 0)
              {
                reload()
              }
       timerID = setTimeout("startClock()", 1000);
              }
      }
      function recache() {
            var now = new Date();
            var camImg = picname + "?" + now.getTime();
            cachepic.src = camImg;
          }
      function reload() {
          document.images.campicture.src = cachepic.src;
          x = speed;
          document.form0.clock.value = x;
                       }
      //end hide -->
      </SCRIPT>
      and this goes in the page (template)

      Code:
      <IMG 
      NAME="campicture" SRC="webcam32.jpg" ALT="Picture" BORDER="0" HEIGHT="240" 
      WIDTH="320" RELOAD="15"><br><FONT SIZE="2">Image will reload in 
      <INPUT TYPE="text" NAME="clock" SIZE="3" VALUE=""> seconds.</FONT>
      <SCRIPT LANGUAGE="JavaScript">
      <!-- hide
      startClock()
      //end hide -->
      </SCRIPT>
      nothing will work when I do this.. but when its in a regular html page it works just fine.

      Comment


      • #4
        Looking at your code for the image I can see no container form for the input field.
        Could this not cause it to give problems when the script comes to "document.form0.clock.value = x;"?

        Comment

        Loading...
        Working...
        X