先严重差评一下,用这种方法window.parent.document.frames['layui-layer-iframe1']不行!而且frames方法存在浏览器不兼容问题(貌似火狐不行)

页面document明明就拿到的iframe元素

接下来考虑用jquery来拿,亲测可行,但是!jquery又怎么拿得到iframe页面里面的js变量,拿不到的,这个方法等于$(document),拿拿页面元素还可以。。。

parent.$("#layui-layer-iframe1").contents().find("input[name='applyAppcode']").val(data.app_code);

我们还是老实用js方法拿吧!

拿iframe:window.parent.document.getElementById('layui-layer-iframe1')

拿iframe窗体:window.parent.document.getElementById('layui-layer-iframe1').contentWindow

拿页面doc:window.parent.document.getElementById('layui-layer-iframe1').contentWindow.document

拿js变量或方法:window.parent.document.getElementById('layui-layer-iframe1').contentWindow.变量/方法

想用jquery拿页面元素:$(window.parent.document.getElementById('layui-layer-iframe1').contentWindow.document).find("");

拿到iframe页面里面的变量及元素的方法的更多相关文章

  1. jquery、js调用iframe父窗口与子窗口元素的方法整理

    1. jquery 在iframe子页面获取父页面元素代码如下: $("#objid", parent.document) 2. jquery在父页面 获取iframe子页面的元素 ...

  2. JQuery操作iframe父页面与子页面的元素与方法

    JQuery操作iframe父页面与子页面的元素与方法 JQUERY IFRAME 下面简单使用Jquery来操作iframe的一些记录,这个使用纯JS也可以实现. 第一.在iframe中查找父页面元 ...

  3. iframe中操作主体页面的元素,方法

    在不使用三大框架的情况下,iframe的使用可以做到在页面中直接引入别的页面作为当前页面的一部分,但是在iframe的使用过程中存在一些相互之间的操作 例如在iframe中获取主页面的元素,使用主页面 ...

  4. 在JSP页面中调用另一个JSP页面中的变量

    在jsp学习中,经常需要在一个jsp页面中调用另一个jsp页面中的变量,下面就这几天的学习,总结一下. jsp页面之间的变量调用有多种方法: 1.通过jsp的内置对象—request对象获取参数: ( ...

  5. iframe获取父、子窗口的元素和方法

    原文地址:https://www.cnblogs.com/BlingSun/p/7484237.html jQuery.js调用iframe父窗口与子窗口元素的方法(亲测有效) 子页面获取父页面的id ...

  6. lhgdialog: iframe页面里面的,确定,关闭、取消按钮的操作

    lhgdialog: iframe页面里面的,确定,关闭.取消按钮的操作 如果你正在用lhgdialog,用他人iframe,或者 content:'url:http://www.baidu.com/ ...

  7. JQuery调用iframe父页面元素与方法

    JQuery操作iframe父页面与子页面的元素与方法 下面简单使用Jquery来操作iframe的一些记录,这个使用纯JS也可以实现. 第一.在iframe中查找父页面元素的方法: $('#id', ...

  8. layer.open打开iframe页面的调用父页面方法及关闭

    //调用父类方法 window.parent.exportData($('#shownum').val(),$('#splitstr').val()); //关闭iframe页面var index = ...

  9. jQuery 互相调用iframe页面中js的方法

    1,子iframe内调用父类函数方法: window.parent.func(); 2,子Iframe中获取父界面的元素: $("#xx", window.parent.docum ...

随机推荐

  1. leetcode-algorithms-19 Remove Nth Node From End of List

    leetcode-algorithms-19 Remove Nth Node From End of List Given a linked list, remove the n-th node fr ...

  2. HDU-6336-构造

    Problem E. Matrix from Arrays Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 ...

  3. 1003. Check If Word Is Valid After Substitutions Medium检查替换后的词是否有效

    网址:https://leetcode.com/problems/check-if-word-is-valid-after-substitutions/ 参考:https://leetcode.com ...

  4. img 标签

    设计网页时经常使用的图片有三种,它们的相同点是都经过了压缩,压缩比越高,图像品质越差. GIF(Graphics Interchange Format):最多支持256色,支持透明,支持多帧动画显示效 ...

  5. TOR的十个最好的替代工具

    TOR的十个最好的替代工具: 一.Comodo Dragon(基于Chromium) TOR基于Firefox,因为我们换个口味,首先推荐一个基于开源项目Chromium的Comodo Dragon, ...

  6. Apache隐藏版本号教程(CentOS)

    1 找到Apache配置文件/etc/httpd/conf/httpd.conf 2 给该文件添加写权限:chmod u+w httpd.conf 3 打开该文件找到ServerTokens字段将其值 ...

  7. Android面试优雅地介绍自己的项目

    本文转载:m.blog.csdn.net/iamsamzhang/article/details/51916584 先说句题外话,很多公司16年秋招的内推已经开始啦,我目前知道的在北京有网易.百度和微 ...

  8. ie edge 自动给数字加下划线

    <meta name="format-detection" content="telephone=no,email=no,address=no">

  9. oracle如何创建表的自增ID(通过触发器)

    Oracle中创建表的自增ID(通过触发器),序列的自增ID和触发器的自增ID的区别 1.新增数据(序列) --创建示例表 -- create table Student( stuId ) not n ...

  10. js如何通过末次月经日期计算预产日期

    计算方式有两种 1)直接添加280天 2)添加10月8天(参数传递,可用改成9月7天等) js中引入文件 <script src="js/jquery.min.js"> ...