js获取iframe的parent对象】的更多相关文章

使用谷歌浏览器调试代码时无意间发现了一个奇特的问题:从iframe页面调用父级页面的方法,window.parent.text(),出现 Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match., 这主要是没有获取iframe所在页面的parent的造成的   如果在本地用file协议使…
  js 获取iframe页面元素 CreationTime--2018年8月16日18点00分 Author:Marydon <!-- chart图表 --> <iframe id="myframe" src="<c:url value="/base/server/report/report.do?REPORT_ID=${param.REPORT_ID}"/>" height="100%" wi…
项目中通过iframe内嵌了一个子页面,子页面定义了一些全局变量,父页面需要获取子页面的全局变量,做了一些测试(我的环境IE10和Firefox32.0.3),得出如下结论: IE下: window.frames['iPage'].变量名  火狐下:window.frames['iPage'].contentWindow.变量名  IE&火狐下:document.getElementById('iPage').contentWindow.变量名 具体原因没有深究,今天在调试一个iframe例子的…
摘自:http://blog.csdn.net/kongjiea/article/details/38870399 1.在父页面 获取iframe子页面的元素 (在同域的情况下 且在http://下测试,且最好在iframe onload加载完毕后 dosomething...) js写法 a.同过contentWindow获取 也有用contentDocument 获取的 但是contentWindow 兼容各个浏览器,可取得子窗口的 window 对象.contentDocument Fir…
在父窗口中获取iframe中的元素 // JS // 方法1: var iframeWindow = window.frames["iframe的name或id"]; iframeWindow.document.getElementById("iframe中控件的ID"); // 方法2: var iframeWindow = document.getElementById("iframe的name或id").contentWindow; ifr…
做个页面 需要加入a.html 使用的js动态添加iframe 直接JQ添加的 代码 $(".banner-box").after(“<iframe src="http://www.xxx.com/publish/d1111top.html" height="8191" width="100%" frameborder="0" scrolling="no" id="fra…
今天要修改编辑器插件中的元素遇到的问题 jquery 在父窗口中获取iframe中的元素 1.Js代码 格式:$("#iframe的ID").contents().find("#iframe中的控件ID").click();//jquery 方法1 实例:$("#ifm").contents().find("#btnOk").click();//jquery 方法1 2.Js代码 格式:$("#iframe中的控件I…
在父窗口中获取iframe中的元素 IE下:格式:window.frames["iframe的name值"].document.getElementById("iframe中控件的ID").click(); 实例:window.frames["ifm"].document.getElementById("btnOk").click(); 都支持的方法:格式:document.getElementById("ifram…
  第一种情况: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…
最近在写页面遇到了问题,一个dom好多地方用到,然后我就单独写了个html页面,然后用iframe引入,但是,想获取iframe里面input的value,获取不到input,后面才知道原来js不能直接获取iframe里面的元素,上代码 引入公共html :deadSeedling.html <IFRAME id="deadSdl" marginWidth=0 marginHeight=0 src="common/deadSeedling.html" fram…