1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What is wrong with this?

Discussion in 'HTML & Website Design' started by fcmisc, Jan 8, 2011.

  1. #1
    Using IE, I get an object expected error on line 22, char 1.

    I basically copied the code from fracta.net and tried to modify it with my own urls. In Chrome it gives me more than 3 frames for some reason, though it looks OK in IE.

    <html>
    <head>
    <title>A simple frameset document with auto refersh by Edgar Badawy http://fracta.net</title>
    <script language="javascript"> 
    function doRefresh(){
    
    var callB = function(){
    // in milliseconds, so 10000 is 10 s
    window.setTimeout(callB, 1000 * 60 * 15;
    parent.frames[1].location.href = "http://www.google.com/" ;
    parent.frames[2].location.href = "http://www.yahoo.com/";
    
    }
    
    window.setTimeout(callB, 10000);
    
    }
    
    </script>
    </head>
    <frameset cols="10%,40%,50%">
    <frame name="f0" onload="doRefresh();" src="#" />
    <frame name="f1" src="http://www.msn.com/" />
    <frame name="f2" src="http://www.bbc.com" />
    </frameset>
    </html>
    HTML:

     
    fcmisc, Jan 8, 2011 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Missing bracket in the first setTimeout statement. Also, there is no point in calculating the time every pass.
    Move the onload event to the frameset. It does not work in the first frame, at least not in Firefox.

    
    <html>
    <head>
    <title>A simple frameset document with auto refersh by Edgar Badawy http://fracta.net</title>
    <script language="javascript">
    function doRefresh(){
    
    var callB = function(){
    // in milliseconds, so 10000 is 10 s
    window.setTimeout(callB, 900000);
    parent.frames[1].location.href = "http://www.google.com/" ;
    parent.frames[2].location.href = "http://www.yahoo.com/";
    
    }
    
    window.setTimeout(callB, 10000);
    
    }
    
    </script>
    </head>
    <frameset cols="10%,40%,50%" onload="doRefresh();">
    <frame name="f0" src="#" />
    <frame name="f1" src="http://www.msn.com/" />
    <frame name="f2" src="http://www.bbc.com" />
    </frameset>
    </html>
    
    Code (markup):
     
    Cash Nebula, Jan 8, 2011 IP
    fcmisc likes this.