基于ID调用iframe页面(附代码)

php中世界最好的语言
php中世界最好的语言 原创
2018-04-26 15:34:31 1320浏览

这次给大家带来基于ID调用iframe页面(附代码),基于ID调用iframe页面的注意事项有哪些,下面就是实战案例,一起来看一下。

$(window.parent.
document
).contents().find("#iframeID")[0].contentWindow.initPagerList();

说明:

iframeID 为iframe的ID;

initPagerList 为 iframe 页面内的方法。

<html>
<head>
 <title></title>
 <script>
  $(function(){
    /*
     说明: iframeID 为iframe的ID;
     initPagerList 为 iframe 页面内的方法。
    */
    //调用iframe页面iframeID中的initPagerList方法
    $(window.parent.document).contents().find("#iframeID")[0].contentWindow.initPagerList();
    //获取iframe页面iframeID中的文本框txtControlID对象
    var txtControlObj=$(window.parent.document).contents().find("#iframeID")[0].contentWindow.find("#txtControlID");
    //为iframe页面iframeID中的文本框txtControlID赋值
    txtControlObj.val("我就是你需要设置的内容值!");
  });
 </script>
</head>
<body>
</body>
</html>

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

jquery怎样让iframe自适应前端高度

jquery+js调用iframe父窗口与子窗口步骤详解

以上就是基于ID调用iframe页面(附代码)的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。