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 ?
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;
This is also very nice script..but I mean to see 4 cams at the same time together..
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;
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
Forum Rules
Bookmarks