Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a Java Script for webcam

Status
Not open for further replies.

emomoney

Technical User
May 11, 2004
5
US
I'm looking for a simple javascript to add to my family site that will display the status of my webcam. For example, if my webcam is on, it will display an online status and of it is off, it will display an offline status. That way if people see it's online they can goto the webcam page, instead of checking if it's on all the time. The actual webcam will run off a laptop seperate from the webserver. Any suggestions?
 
Ok, some more info. This is the script I am using, but the problem is, it's always reporting the webcam to be online, even whe it isn't. Any suggestions? I am also using WebcamXP.
In the head section:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

newurl = new Array;
newurl[1] = "URL of my webcam server";

online = new Array;
online[1] = 'image1.jpg';

offline = 'image2.jpg';

indicator = new Array;

function CheckStatus(cam,mode)
{
// mode = 0 : goes to new url if online else pops up an alert window
if (mode == 0)
{if (indicator[cam] == 1){document.location.href = newurl[cam];}
else{alert("WebCam is Offline!");}}

// mode = 1 : displays online image
if (mode == 1)
{indicator[cam] = 1;document["indicator"+cam].src = online[cam];}

// mode = 2 : displays offline image
if (mode == 2)
{indicator[cam] = 0;document["indicator"+cam].src = offline;}
}

//-->
</SCRIPT>

In the body section:
<A HREF="javascript:CheckStatus(1,0)">
<IMG SRC="javascript:CheckStatus(1,1)" NAME="indicator1"
onError="javascript:CheckStatus(1,2)" border="0" width="86" height="17">
</A>
 
You don't seem to be finding the status anywhere.

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakesperean sonnet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top