语法:父对象.prototype.isPrototypeOf(子对象) 代码栗子: function Student(){ this.name = "小马扎"; ; } var sky = new Student(); var img = new Image(); console.log(Student.prototype.isPrototypeOf(sky)); // true console.log(Student.prototype.isPrototypeOf(img)); //
在iframe中很多要用的子页面父页面函数互调的情况,下面看一下各自用法,本人写个人网站的时候用过其他场景尚未试过 子页面调父页面 function fu(){ alert('父'); } function zi(){ parent.fu(); } 父页面掉子页面 <iframe name="myFrame" src="child.html"></iframe> function fu(){ myFrame.window.zi(); } fu
javascript获取iframe框架中,加载的页面document对象 因为浏览器安全限制,对跨域访问的页面,其document对象无法读取.设置属性 function getDocument(iframe) { var Doc; try{ Doc = iframe.contentWindow.document;// For IE5.5 and IE6 }