js获取iframe里面的dom】的更多相关文章

最近在写页面遇到了问题,一个dom好多地方用到,然后我就单独写了个html页面,然后用iframe引入,但是,想获取iframe里面input的value,获取不到input,后面才知道原来js不能直接获取iframe里面的元素,上代码 引入公共html :deadSeedling.html <IFRAME id="deadSdl" marginWidth=0 marginHeight=0 src="common/deadSeedling.html" fram…
转:http://www.css88.com/archives/2343 一.父级窗口操作iframe里的dom JS操作iframe里的dom可是使用contentWindow属性,contentWindow属性是指指定的frame或者iframe所在的window对象,在IE中iframe或者frame的contentWindow属性可以省略,但在Firefox中如果要对iframe对象进行编辑则,必须指定contentWindow属性,contentWindow属性支持所有主流浏览器. 相…
做个页面 需要加入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…
1.代码1  index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>我是demo1.html</title> <script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8">&l…
创建元素节点 1.原生: document.createElement("div") 2.jquery: $("<div></div>") 创建文本节点并加入元素节点中 1.原生: var text=document.createTextNode("文本内容"); var p=document.createElement("p"); p.appendChild(text); 2.jquery: var …
这里简单说明两个方法,都是未跨域情况下在index.html内操作b.html内的 DOM. 如:index.html内引入iframe,在index内如何用JS操作iframe内的DOM元素? 先贴下index.html和iframe引入的a.html内容. index-> <div class="d1"> <iframe src="a.html" frameborder="0" name="one"…
最近接手了别人的项目,别人用到了iframe,自己在实战中总结了一些关于iframe的小问题. 获取Iframe页面高度并赋值给Iframe Html <iframe name="container_ifranme" id="iframeId" scrolling="no" frameborder="no" border="0" src="home.html" onLoad=&qu…
父窗口中操作iframe:$(window.frames["iframeChild"].document)    //假如iframe的id为iframeChild 在子窗口中操作父窗口:$(window.parent.document) 接下来就可以继续获取iframe内的dom了. 获取iframe内的dom对象有两种方法 1 $(window.frames["iframeChild"].document).find("#child") 2…
  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…
javascript 获取iframe里页面中元素值的方法 IE方法:document.frames['myFrame'].document.getElementById('test').value; 火狐方法:document.getElementById('myFrame').contentWindow.document.getElementById('test').value; IE.火狐方法: function getValue(){ var tmp = ''; if(document.…