子页面获取父页面元素
//js //获取父页面的window window.parent //获取父页面元素 window.parent.document.getElementById("objid"); //jq //获取父页面元素 $("objname",parent.document);
//js //获取子页面的window 1.document.getElementById("testiframe").contentWindow 2.window.frames[0] 3.$("#testiframe")[0].contentWindow //调用子页面函数 document.getElementById(子页面id).contentWindow.子页面方法() --------------------------------------------------------------- //jq var _iframe = document.getElementById('left').contentWindow; //iframe子页面的元素 $("objid",document._iframe('iframename').document)
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/175852.html原文链接:https://javaforall.net
