Need help with the following script

R

Roel

Hello,

I have a simple script that will reload http://website/CAM1picture.jpg every
xx minutes. I'm trying to add a form <input type="submit" value="CAM1"
name="B1"><input type="submit" value="CAM2" name="B1"> So when I click on
CAM2 button it will reload http://website/CAM2picture.jpg and when I click
on CAM3 button it will reload http://website/CAM3picture.jpg and so on.

I appreciate if someone can show me how to do it. Here's a copy of the html
with the script.

==== Start HERE ===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ICUx10</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!-- hide
var x = 10;
var y = 1;
var now;

function countdown() {
x = x-y;
document.form1.clock.value = x;
if (x <= 1) reload();
timerID = setTimeout("countdown()", 1000); }

function reload() {
now = new Date();
var camImg = "http://website/CAM1picture.jpg" + "?" + now.getTime();
document.ICUx10.src = camImg;
x = 10;
document.form1.clock.value = x; }
-->
</script>
</head>
<body onload="countdown()">
<p class="imgcen" align="center"><b><i><font face="Arial" color="#000080"
size="7">Sarceno's
Webcam</font></i></b>
<p class="imgcen" align="center">&nbsp;
<div align="center">
<center>
<table border="15" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="center"><img name="ICUx10"
src="http://website/CAM1picture.jpg" border=0 width=320 height=240></td>
</tr>
</table>
</center>
</div>
<p class="imgcen" align="center">
<form action="" name="form1" class="timer">
<p align="center"><font color="#ff0000">This screen will refresh
in</font> <input TYPE="text" NAME="clock" SIZE="2">
<font color="#ff0000">second</font><br>
</form><br>
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<form method="POST">
<p><input type="submit" value="CAM1" name="B1"><input
type="submit" value="CAM2" name="B1"><input type="submit" value="CAM3"
name="B1"></p>
</form>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>

==== END HERE ===

Thanks
 
J

Jitendra Tulsiani

Try using '<input type="button">' instead of '<input type="submit">' with
the 'onclick' event handler.
Also consider using a parameter with the 'reload' function.

I would have provided you the code to explain my view...but then, and who
wouldn't agree, programmers are lazy...
If you still need help, just inform me...

Jitendra Tulsiani
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top