assigning an onload event to a frame

F

foldface

Hi
I have 2 frames on a web page, both frames hold webpages that start
with
http://localhost/ (hence avoiding cross scripting errors)
I want one frame to control the other, to load up the web pages,
press
buttons etc.
I've got this working by using the below (snippet enclosed). When a
page
is loaded, SetPageLoadValue is called
My question is why does it only work with the variant shown, why don't
the commented out lines have the same effect?
I don't know the dom that well so I've tried inserting the word
'document'
into the MainFrame/MainDocument functions in different places to no
avail

Thanks
F



function Go()
{
//MainFrame().attachEvent('onload',SetPageLoadValue);
//MainFrame().onload = function(){SetPageLoadValue()}
//MainDocument().attachEvent('onload',SetPageLoadValue);
//MainDocument().onload = function(){SetPageLoadValue()}

parent.document.getElementsByTagName('frame')['Main'].attachEvent('onload',
SetPageLoadValue);
}

function MainDocument()
{
return parent.frames['Main'].document;
}

function MainFrame()
{
return parent.frames['Main'];
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top