Web Analytics Made Easy -
StatCounter Url Reload In a frameset. - CodingForum

Announcement

Collapse
No announcement yet.

Url Reload In a frameset.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Url Reload In a frameset.

    I want to have a url load in the bottom frame of a page.

    I have a webpage with two frames a small top frame"frame1" and the bottom frame "frame2" I want the top "frame1" to have an image and the code in it, and then the url to reload in the bottom frame "frame2" every 2mins. I have the banner image done but can not get the url to reload in the bottom frame. I had this code and it worked fine but loaded in the same page and only once, I figured this is why I need the frames so it loads in the bottom frame each time. I also would like a small hit counter in the top frame that shows how many times it has refreshed the page. Thanks. Help please.

    Here is the code I have now.

    <script language="JavaScript">
    <!--
    var time = null
    function move() {
    window.location = 'http://www.cnn.com/'
    }
    //-->
    </script><body onload="timer=setTimeout('move()',200000)">

  • #2
    Code:
    <script language="JavaScript">
    <!--
    var time = null
    var refreshCount = 0;
    function move() {
      if ( window.top.frames ) {
        window.top.frames["frame2"].location.href = 'http://www.cnn.com/';
        refreshCount++;
      }
    }
    //-->
    </script><body onload="timer=setInterval('move()',200000)">
    Last edited by shyam; Aug 3, 2005, 08:40 PM.
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

    Comment


    • #3
      Ok, thanks.

      I pasted the code in but nothing happens.
      And I get the error icon bottom left of page.

      Can you upload the whole page please with the code. I am missing something here.


      Also do I have to set a value for this instead of 0?

      var refreshCount = 0;



      Thanks
      Last edited by tim_ver; Aug 3, 2005, 11:09 PM.

      Comment


      • #4
        worx for me...is there some issue with IE or something ?

        index.htm
        Code:
        <html>
            <frameset cols="200,*">
              <frame src="frame1.htm" name="frame1">
              <frame src="frame2.htm" name="frame2">
            </frameset>
        </html>
        frame1.htm
        Code:
        <html>
          <head>
        <script language="JavaScript">
        <!--
        var timer = null;
        var refreshCount = 0;
        function move() {
          if ( window.top.frames ) {
          	//alert("move");
            window.top.frames["frame2"].location.href = 'http://www.cnn.com/';
            refreshCount++;
          }
        }
        function start() {
        	//alert("start");
        	timer = setInterval('move()',5000);
        }
        //-->
        </script>
          </head>
          <body onload="start()">
            hi i'm frame 1
          </body>
        </html>
        frame2.htm
        Code:
        <html>
          <head>
          </head>
          <body>
            Hi i'm frame 2
          </body>
        </html>
        You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

        Comment


        • #5
          Ok it works. Is there a easy way to add a counter for every refresh that is done?

          Is 500000 5mins?

          Also this will refresh ever 5 mins forever right?

          Thanks
          Last edited by tim_ver; Aug 4, 2005, 03:20 PM.

          Comment


          • #6
            I'd like to have this same thing. But I want a top frame with the code in it and two bottom frames to each be refreshed every 5 minutes. Thanks.
            Master Newbie http://dwightstegall.com/

            Comment


            • #7
              I figured it out already. I changed move() to move1() and made another move2().
              Master Newbie http://dwightstegall.com/

              Comment


              • #8
                the timer is set in milliseconds

                5 minutes of 60 seconds of 1000 milliseconds

                5 mins = 5*60*1000 = 300000 milliseconds
                Index Dot Html/Css - Download a jQuery Library - The W3C Markup Validation Service

                Comment

                Working...
                X