create a frameset and redirect the page

Subscribe to create a frameset and redirect the page 6 posts, 3 voices

 
greyg00 User

Is there a way to create a frameset of two frames, one on the top and a menu bar on the bottom, so that the page loads on the top frame and the menu-bar contains a static page?
And is it possible to open automatically one link in the toolbar?

Thanks in advance!

 
greyg00 User

I found a solution inspiring myself from te script: Craigslist skin BETA,

document.body = document.createElement('frameset');
document.body.setAttribute('rows','*,150');
topFrame = document.createElement('frame');
topFrame.setAttribute('name',"top");
topFrame.setAttribute('src',src);

bottomFrame = document.createElement('frame');
bottomFrame.setAttribute('name',"bottom");
bottomFrame.setAttribute('src','');

document.body.appendChild(topFrame);
document.body.appendChild(bottomFrame);

now the problem is that i can't add an event listener to the frame 'top.frames[1]' , does anybody know how can I add an eventlistener to a frame?

 
Aquilax Scriptwright

Frames support very few events: load, unload, resize, moreover I think you have some cross site restriction

 
greyg00 User

So...should this work?

top.frames[1].addEventListener('load', changeMenu, false);

Because I cannot get the sctipt to execute the changeMenu function...

Thanks!

 
lazyttrick Scriptwright

maybe unsafeWindow.top.frames[1].addEventListener('load', changeMenu, false);
or document.getElementById('frameid').addEventListener('load', changeMenu, false);

 
Aquilax Scriptwright

You create the topFrame that load a frameset? Quite complicated, first you have to wait for the topFrame to finish load the frameset, then you can add the event listener to the top topFrame.frames[1].