[Java教程]获取父窗口元素或者获取iframe中的元素(相同域名下)
0 2017-03-15 00:00:35
jquery方法
在父窗口中获取iframe中的元素//方法1$("#iframe的ID").contents().find("iframe中的元素");//实例:$("#ifr").contents().find("#someid");
//方法2$("#iframe中的控件ID",document.frames("frame的name").document);//实例$("#someid",document.frames("ifr").document);
在iframe中获取父窗口的元素//方法
$('#父窗口中的元素ID', parent.document);//实例$('#someid', parent.document);
js方法
在父窗口中获取iframe中的元素//方法window.frames["iframe的name值"].document.getElementById("iframe中控件的ID");//实例window.frames["ifr"].document.getElementById("someid");
在iframe中获取父窗口的元素//方法window.parent.document.getElementById("父窗口的元素ID");//实例window.parent.document.getElementById("someid");
欢迎补充!
本文网址:http://www.shaoqun.com/a/303506.html
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:admin@shaoqun.com。
0