(1) The child page calls the parent page method or variable:
window.parent.Method() or variable name
window.parent is equivalent to writing the same operation after locating to the parent page as writing code in the parent page
window.parent.aa();//Calling the aa function window.parent.bb;//Calling the bb variable For example: Want to get the value of the text box with id aaa in the subpage window.parent.$("#aaa").val();//The premise of this writing is to reference jquery window.parent.getElementById("aaa").value; //JS writing method(2) Parent page retrieves child page
Mainly, it is to locate the subpage through contentWindow
document.getElementById("childframe").contentWindow.childtest();//Writing method of js in the child page var childWindow = $("#addFrame")[0].contentWindow;//Get the object childWindow.formSubmit();//Writing method of jquery in the child page //Note: where both childframe and addFrame are id of the iframeThe above article briefly discusses the mutual call of the parent page method variables of the js neutron page is all the content I share with you. I hope it can give you a reference and I hope you can support Wulin.com more.