ITeye博客

js 调用iframe里面的js函数

lkf009 · 2013-05-22 12:45 · javascript · Web前端 · JavaScript · Web · Markdown

当iframe有name属性的时候

<iframe id="contentid" name="contentname" src="" height="100%" frameborder="0"></iframe>

可以这样调用:

contentname.window.submit();

 

当iframe没有name属性的时候

<iframe id="contentid" src="" height="100%" frameborder="0"></iframe>

$("#contentid")[0].contentWindow.submit();  

或者

document.getElementById("contentid").contentWindow.submit();

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。