Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    trying to make js reload my iframe

    I know it's close, but it just sits there. I'm asking it to load a testcard, for obvious reasons. what am I doing wrong?

    Also, i'm after a way to load the testcard in into IframeL when the webcam is off. IE when that tries to load and gets an error. Can't find anything to do with this, where it load another url. Any ideas?

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
      <title>Untitled Document</title>
      <meta http-equiv="Content-Type"
     content="text/html; charset=iso-8859-1">
    <script language="javascript">
    function reloadIt()
    {
    frm=document.getElementsById("myFrameR");//we get the iframe object
    //frm.src=frm.src;//or you can set the src to a new src.
    frm.src="http://192.168.1.3/webcam/bkup/testcard.jpg";
    setTimeout("reloadIt()",60000);//the function will run every 60000 miliseconds, or 60 seconds
    }
    </script>
    </head>
    <body onload=reloadIt() bgcolor="#6699ff" >
    <div align="center">
    <p><font face="Courier New, Courier, mono"><b><font color="#00ffff"
     size="+7">Webcam</font></b></font></p>
    <div style="text-align: center;"><span style="color: black;"> <br>
    Last Updated:
    <br>
    
    <script type="text/javascript" language="JavaScript1.1">
          <!-- 
              
          lastmod = document.lastModified     // get string of last modified date
          lastmoddate = Date.parse(lastmod)   // convert modified string to date
          if(lastmoddate == 0){               // unknown date (or January 1, 1970 GMT)
             document.writeln("Unknown")
          } else {
          d = new Date(lastmod);
          document.write(d);
          }// -->
        </script>
    </span><br>
    <br>
    <table style="text-align: left; width: 100%;" border="1" cellpadding="2"
     cellspacing="2">
      <tbody>
        <tr>
          <td
     style="vertical-align: top; text-align: center; background-color: rgb(255, 204, 0);">Live
    Webcam<br>
          </td>
          <td
     style="vertical-align: top; text-align: center; background-color: rgb(255, 204, 0);">Last
    Snap reload every 5mins<br>
    
          </td>
        </tr>
        <tr>
          <td style="text-align: center; vertical-align: top;"> <iframe
     id="myFrameL" src="http://192.168.1.3:8800/" height="256" width="338"> If you can
    see this, your browser doesn't understand IFRAMEs. 
    </iframe> 
    </td>
    <td style="text-align: center; vertical-align: top;"> <iframe
     id="myFrameR" src="http://192.168.1.3/webcam/lastpic.jpeg" height="256" width="338">
    If you can see this, your browser doesn't understand IFRAMEs.
    
          </iframe> <br>
          </td>
    
        </tr>
      </tbody>
    </table>
    <br>
    <br>
    </div>
    <div id="top"></div>
    <div style="text-align: center;"><a
     href="http://www.freesitemapgenerator.com/"><img
     alt="Free Sitemap Generator"
     style="border: 0pt none ; margin: 3px; padding: 0pt;"
     src="http://live.freesitemapgenerator.com/img/fsgbig41.gif" border="0"></a></div>
    <script language="javascript">
    /* FSG 0.96 script */ 
    var fsg_Live_date_package_version='0.96';
    var fsg_image = 'big4';
    var fsg_serial = 'b816a328c80a0b3c1fe4c083ac851ed6';
    </script>
    <script language="javascript"
     src="http://live.freesitemapgenerator.com/scripts/fsg096.js"></script></div>
    </body>
    </html>

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    change

    Code:
    frm.src="http://192.168.1.3/webcam/bkup/testcard.jpg";
    to
    Code:
    frm.src="http://192.168.1.3/webcam/bkup/testcard.jpg?q=" + (new Date().getTime().toString());
    so you can avoid the cache.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

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