...

View Full Version : is possible to set order to display frames?



LottaLava
01-16-2004, 01:49 PM
Hello folks, im 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

joh6nn
01-16-2004, 04:24 PM
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>

fredmv
01-16-2004, 04:43 PM
Originally posted by joh6nn
for (var 0 = 0;Surely you meant:
for (var i = 0;Just to avoid any confusion. ;)

joh6nn
01-16-2004, 04:50 PM
fixed. thanks ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum