1.子页面查找父页面元素
$('#id', window.parent.document)
$("div.maskdivtest",window.parent.document).remove();
2.在iframe中调用父页面中定义的方法和变量:
parent.method
parent.value
$(function() { //在iframe中查找父页面元素 alert($('#default', window.parent.document).html()); //在iframe中调用父页面中定义的方法 parent.getHelloWorld(); //在iframe中调用父页面中定义的变量 alert(parent.hello); });
复制