Need help with the following script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roel

    #1

    Need help with the following script

    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"><inpu t 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("cou ntdown()", 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="countdo wn()">
    <p class="imgcen" align="center"> <b><i><font face="Arial" color="#000080"
    size="7">Sarcen o'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"><inpu t
    type="submit" value="CAM2" name="B1"><inpu t type="submit" value="CAM3"
    name="B1"></p>
    </form>
    </td>
    </tr>
    </table>
    </center>
    </div>
    </body>
    </html>

    ==== END HERE ===

    Thanks


  • Jitendra Tulsiani

    #2
    Re: Need help with the following script

    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

    "Roel" <rsarceno@nospa m.comcast.net> wrote in message
    news:i2Nib.1198 64$%h1.127776@s ccrnsc02...[color=blue]
    > Hello,
    >
    > I have a simple script that will reload http://website/CAM1picture.jpg[/color]
    every[color=blue]
    > xx minutes. I'm trying to add a form <input type="submit" value="CAM1"
    > name="B1"><inpu t type="submit" value="CAM2" name="B1"> So when I click on
    > CAM2 button it will reload http://website/CAM2picture.jpg and when I[/color]
    click[color=blue]
    > 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[/color]
    html[color=blue]
    > 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("cou ntdown()", 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="countdo wn()">
    > <p class="imgcen" align="center"> <b><i><font face="Arial"[/color]
    color="#000080"[color=blue]
    > size="7">Sarcen o'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"><inpu t
    > type="submit" value="CAM2" name="B1"><inpu t type="submit" value="CAM3"
    > name="B1"></p>
    > </form>
    > </td>
    > </tr>
    > </table>
    > </center>
    > </div>
    > </body>
    > </html>
    >
    > ==== END HERE ===
    >
    > Thanks
    >
    >[/color]


    Comment

    Working...