Results 1 to 2 of 2

Thread: [RESOLVED] Webcam javascript not working in Firefox

  1. #1
    Frenzied Member
    Join Date
    Oct 00
    Posts
    1,372

    Resolved [RESOLVED] Webcam javascript not working in Firefox

    Hi everyone,

    The following script refreshes fine in internet explorer but with firefox it only refreshes when I refresh the browser. Can anyone tell me what I need to change to make it work for firefox? Can an 'IF' statement be added to check for browser type to make the same script work for both? Thanks for your help!!

    Code:
    <SCRIPT>
    browserType = navigator.appName;		
    newImage = new Image();
    var dly;
    document.write('<IMG SRC="pic.jpg?" name=Watch Alt="loading2" border=0 >');
    uniq= 1;
    newImage.src= 'pic.jpg?' + uniq;
    SnapShot_Loop(300);
    function SnapShot_Loop(delay) 
    {
     dly= delay 
     if( document.all) loadNewImage();
     setTimeout("SnapShot_Loop(dly)",delay);
    }
    function loadNewImage()
    {
    Stamp = new Date();
    uniq= Stamp.getTime();
    document.images.Watch.src= newImage.src;
    newImage.src= 'pic.jpg?' + uniq;
    window.status = 'pic.jpg?' + uniq;
    }
    </SCRIPT>

  2. #2
    Frenzied Member
    Join Date
    Oct 00
    Posts
    1,372

    Re: Webcam javascript not working in Firefox

    I searched and found another script in case anyone needs one that works in both browsers.

    Code:
    <script language="javascript" type="text/javascript" >
    <!--
    function ChangeMedia(){
    	var d = new Date();
    	var t = d.getTime();
    	document.getElementById('camara').src = "pic.jpg?"+t;
    }
    var reloadcam = setInterval("ChangeMedia()",500);
    -->
    </script>
    <img src="pic.jpg" alt="Loading..." name="camara" width="450" height="335" border="0" id="camara" />

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •