开发者

Call parent javascript function from child frameset's javascript

开发者 https://www.devze.com 2023-01-18 14:29 出处:网络
I am using frameset in my page. In the frameset i have taken two frames and in the first frame i have written some javascript code. How the javascript functi开发者_Python百科on of the frame will call

I am using frameset in my page. In the frameset i have taken two frames and in the first frame i have written some javascript code. How the javascript functi开发者_Python百科on of the frame will call the javascript function of the main page.

Can anyone please help :)


This will do it :

parent.FrameName.FunctionName()


If your frames are set up like this:

<frameset rows="50, 50">
    <frame src="menu.html" name="menu">
    <frame src="main.html" name="main">
</frameset>

Then you can access functions in the frame named main from the frame named menu using top.main.functionName().

parent.main.functionName() will also work in this case, but if you have more nested levels of frames then I find it less confusing to reference top (which is always the topmost frame) and 'drill down'.

0

精彩评论

暂无评论...
验证码 换一张
取 消