我有一个函数可以调整“frame.html”中frameset
的col
宽度比:
<frameset id="set" cols="*,*" FRAMESPACING=0 BORDER=3 BORDERCOLOR=#eeeeee>
<frame src="index.html">
<frame src="index2.html">
<noframes></noframes>
</frameset>
从“frame.html”调用时该函数工作正常,但是我想从子文件“index.html”调用所述函数...该函数需要保留在父文件中才能正常运行。 .. 如何从 index.html
frame.html
中的函数
最佳答案
只需尝试 parent.functionName()
就可以了。
编辑
只是为了确保范围正确,您应该调用 window.parent.functionName()
而不是确保它实际上是引用的父框架
编辑2
查看 this answer它似乎处理相同的 chrome 问题。
希望对您有所帮助!
关于javascript - 从子框架调用父文件中的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3615141/