function setIframeHeight(iframe) { if (iframe) { var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; if (iframeWin.document.body) { iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.sc…
项目中很多时候会遇到需要用 iframe 嵌套页面的情况.有时候会有这样的需求: iframe 嵌套的页面 A ,点击之后要跳到页面 B ,但是同时还需要 A 页面中的某个属性值. 此时可以先把 A 页面的属性值赋值给最外层的父页面,然后再赋值给 B 页面. A 页面的值赋值给最外层的父页面: 如父页面有个隐藏的button元素 <input type="button" id="parentID" value="" /> 赋值给此元素…
var iframe = $("iframe[data-id=" + id + " ]"); if (iframe.length > 0) { var exist = $(iframe[0]).attr("exist"); if (exist!=="1") { var loadindex = layer.load(2, { shade: false }); iframe[0].onload = function () {…
第一种情况:iframe中不存在name和id的方法:(通过contentWindow获取) var iframe = document.getElementsByTagName('iframe')[0];var ifr_document = iframe.contentWindow.document;//iframe中的文档内容 或者: var _iframe = document.getElementByIdx_x('iframeId').contentWindow; var _div…