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 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2002
    Location
    São Paulo, BRAZIL
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question is possible to set order to display frames?

    Hello folks, i´m wondering about how or if is possible to define a order to display frames in a web-page, for example: I have those frames in one web-page.

    <frameset rows="10%, 10%, 10%">
    <frame name="frm01" src=/blah01.html">
    <frame name="frm02" src=/blah02.html">
    <frame name="frm03" src=/blah03.html">
    </frameset>


    Frame frm02 must be displayed before all others, can i do that?

    Regards,
    LottaLava

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    i didn't test the following at all, but it SHOULD work, for any number of frames. i think it's pretty well documented, but if you don't understand anything, just let me know.

    <script>
    window.onload = function() {

    /*
    this is a list of all the frames, and the files to load in them,
    in the order in which you want them to be loaded.
    that is, frm02 will load first, then frm01, then frm03
    */
    var loadOrder = [ ["frm02", "blah02.html"],
    ["frm01", "blah01.html"],
    ["frm03", "blah03.html"],
    ];

    for ( var i = 0; i < loadOrder.length - 2; i++) {
    window.frames[loadOrder[i][0]].onload = new Function("window.frames[loadOrder[i+1][0]].location.href = loadOrder[i+1][1];");
    }

    /*
    this next bit is optional, and therefore commented out;
    it allows you to do something when the last frame has loaded.
    i have no idea what you might want to do, but it's a possiblity, so i tossed it in.
    */


    // window.frames[loadOrder[i+1][0]].onload = function() { /* put what you want to happen here */ ; }

    window.frames[loadOrder[0][0]].location.href = loadOrder[0][1];
    }
    </script>
    Last edited by joh6nn; 01-16-2004 at 03:50 PM.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by joh6nn
    for (var 0 = 0;
    Surely you meant:
    Code:
    for (var i = 0;
    Just to avoid any confusion.

  • #4
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    fixed. thanks ;)
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.


  •  

    Posting Permissions

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