开发者

Calling a function in parent file from child frame?

开发者 https://www.devze.com 2023-01-13 18:45 出处:网络
I have a function that resizes the col width ratio of my frameset in \"frame.html\": <frameset id=\"set\" cols=\"*,*\" FRAMESPACING=0 BORDER=3 BORDERCOLOR=#eeeeee>

I have a function that resizes the col width ratio of my frameset in "frame.html":

<frameset id="set" cols="*,*" FRAMESPACING=0 BORDER=3 BORDERCOLOR=#eeeeee>
    <frame src="index.html">
    <frame src="index2.html"> 
    <noframes></noframes> 
</frameset> 

The function works fine when called from "frame.html", Howev开发者_如何学Cer i want to call said function from the child file "index.html"... the function needs to remain in the parent file in order to run properly... How can I call my function in frame.html from index.html


Just try parent.functionName() it should work.

Edit


Just to be sure that the scope is correct you should probably call window.parent.functionName() instead to be sure that it is actually the frames parent that is referenced

Edit 2


Check out this answer it seems to handle the same chrome issue.

Hope it helps!

0

精彩评论

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