最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Calling a function in parent file from child frame? - Stack Overflow

programmeradmin3浏览0评论

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", However 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

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", However 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

Share Improve this question asked Sep 1, 2010 at 5:00 DavidDavid 14k16 gold badges46 silver badges51 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11

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)

  1. 暂无评论