DOM获取页面中的iframe:
window.frames["iframeChild"].document //假如iframe的id为iframeChild
window.parent.document //在子窗口中操作父窗口
获取页面的对象其实就是DOM方法外面加上jquery的选择符:
$(window.frames["iframeChild"].document) //假如iframe的id为iframeChild
$(window.parent.document) //在子窗口中操作父窗口
接下来就可以继续获取iframe内的DOM了,获取iframe内的dom对象有两种方法:
$(window.frames["iframeChild"].document).find("#child") //第一种
$("#child",window.frames["iframeChild"].document) //第二种
1.在父窗口中操作 选中IFRAME中的所有单选按钮
$(window.frames["iframeChild"].document).find("input[@type='radio']").attr("checked","true");
2.在IFRAME中操作 选中父窗口中的所有单选按钮
$(window.parent.document).find("input[@type='radio']").attr("checked","true");
在父页面提交iframe中的表单
frames["iframe"].document.forms["form1"].action="${base}/comSub.jspx";
frames["iframe"].document.forms["form1"].submit();