dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: Very Useful Webcam Code BUT How To Develop?

  1. #1
    Join Date
    Nov 2012
    Posts
    9

    Lightbulb Very Useful Webcam Code BUT How To Develop?

    Below it is very useful webcam image refresh code;

    var refreshrate=4; //SECONDS BETWEEN REFRESH
    var image="cam_office1.jpg"; //IMAGE NAME
    var imgheight=480; //IMAGE HEIGHT
    var imgwidth=640; //IMAGE WIDTH
    function refresh(){
    document.images["pic"].src=image+"?"+new Date();
    setTimeout('refresh()', refreshrate*1000);}
    document.write('<IMG SRC="'+image+'" ALT="WebCam" NAME="pic" ID="pic" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" STYLE="border: 1px solid Black;">');
    if(document.images)window.onload=refresh;


    I don't know javascript, I found code on web. I want to use it in the same webpage for 4 different webcam images together. Can anyone help ?

  2. #2
    Join Date
    Nov 2012
    Posts
    9
    no one can help?

  3. #3
    Join Date
    Aug 2010
    Posts
    6

    i hop that you mean that

    i hope that this is what you mean


    var refreshrate=4; //SECONDS BETWEEN REFRESH
    var image= ["cam_office0.jpg", "cam_office1.jpg", "cam_office2.jpg", "cam_office3.jpg"]; //IMAGES SRC
    var imgheight=480; //IMAGE HEIGHT
    var imgwidth=640; //IMAGE WIDTH
    var imgnum = 0;
    function refresh() {
    if (imgnum >= 4) {
    imgnum =0;
    }
    document.images["pic"].src=image[imgnum]+"?"+new Date();
    imgnum++;
    setTimeout('refresh()', refreshrate*1000);
    }
    document.write('<IMG SRC="'+image+'" ALT="WebCam" NAME="pic" ID="pic" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" STYLE="border: 1px solid Black;">');
    if(document.images)window.onload=refresh;

  4. #4
    Join Date
    Nov 2012
    Posts
    9
    This is also very nice script..but I mean to see 4 cams at the same time together..

  5. #5
    Join Date
    Aug 2010
    Posts
    6
    Check this
    why you need that ?

    var refreshrate=4; //SECONDS BETWEEN REFRESH
    var image= ["cam_office0.jpg", "cam_office1.jpg", "cam_office2.jpg", "cam_office3.jpg"]; //IMAGES SRC
    var imgheight=480; //IMAGE HEIGHT
    var imgwidth=640; //IMAGE WIDTH
    function refresh(){
    document.images["pic1"].src=image[0]+"?"+new Date();
    document.images["pic2"].src=image[1]+"?"+new Date();
    document.images["pic3"].src=image[2]+"?"+new Date();
    document.images["pic4"].src=image[3]+"?"+new Date();
    setTimeout('refresh()', refreshrate*1000);
    }
    document.write('<IMG SRC="'+image+'" ALT="WebCam" NAME="pic1" ID="pic1" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" STYLE="border: 1px solid Black;"><br />');
    document.write('<IMG SRC="'+image+'" ALT="WebCam" NAME="pic2" ID="pic2" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" STYLE="border: 1px solid Black;"><br />');
    document.write('<IMG SRC="'+image+'" ALT="WebCam" NAME="pic3" ID="pic3" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" STYLE="border: 1px solid Black;"><br />');
    document.write('<IMG SRC="'+image+'" ALT="WebCam" NAME="pic4" ID="pic4" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" STYLE="border: 1px solid Black;"><br />');
    if(document.images)window.onload=refresh;

  6. #6
    Join Date
    Nov 2012
    Posts
    9
    Thank you very much, that was what I want...I need this to see all cams at once when I look to the screen.

    At first 4 images seen vertical in browser screen, but after I remove <br /> from the script I can see the 4 images as 2 x 2 matrix square

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles