父页面调用iframe里的js函数

前些天项目碰到这个问题,在ie下可以直接调用iframe里的js函数
如:
document.getElementById('iframedemo').targetfunction();
但是这段代码在firefox下报错,于是上google搜索,发现一个解决办法,在ie和firefox
下均工作正常,代码如下:
document.getElementById('iframedemo').contentWindow.demofunction();
其中iframedemo是iframe的id
posted @ 2009-08-03 17:34  演绎简单  阅读(12123)  评论(1编辑  收藏  举报