JS如何获取iframe内html的body值

default页面:

<html>
<head>
    <script type="text/javascript">
        window.onload=function()
        {
            var img = document.frames["IFeditValue"].document.getElementById(‘editValue‘);
            alert(img.innerHTML);
        }
    </script>
</head>
<body>
    <iframe id="IFeditValue" src="blank.html"  scrolling="auto" height="800" width="1000"></iframe>
</body>
</html>
时间: 2024-07-31 19:37:14

JS如何获取iframe内html的body值的相关文章

Js动态获取iframe子页面的高度总结

问题的缘由 产品有个评论列表引用的是个iframe,高度不固定于是引发这个总结. 方法1:父级页面获取子级页面的高度 给元素设置高度 这方法是用在父级页面里的,通过获取子级页面的高度给iframe设置高度 涉及了一些兼容问题: IE用attachEvent | 3C用onload来判断子页面是否加载完成. IE用contentWindow | 3C用contentDocument来获取子页面 IE用document.documentElement.scrollHeight(兼容ie6 ie7)|

Python3.x:获取iframe内嵌页面的源码

Python3.x:获取iframe内嵌页面的源码 前言 在一些网页中经常会看到ifrmae/frame标签,iframe是嵌入式框架一般用来在已有的页面中嵌入另一个页面,当一个元素在iframe里时我们应该先切换到iframe里面. 语法 1.进入iframe iframe = self.driver.find_element_by_xpath("//iframe[contains(@src,'https://************/auth?e_p=1&response_type=

使用JS/JQ获取iframe里面的元素

首先实现父级通过iframe访问子级DOM元素有以下几点需要特别注意的 1,需要在服务器的情况下访问,可以使用本地服务器 2,需要使用入口函数(当初被这个坑惨了) 3,这种方法跨域访问不了 >*使用本地服务器 首先建立两个文件分别命名为父级parantN.html和子级Child.html两个html文件,先看看html文件代码. 父级parantN.html <iframe id='myIframe' name="myIrame" src="Child.html

JS 获取 iframe内元素,及iframe与html调用

两种获得iframe内元素的方法 jquery获取$("#atrDialogIframe_protocoliframe").contents().find('span').text() JS原生获取document.getElementById("atrDialogIframe_protocoliframe").contentWindow.document.getElementById("span") iframe调用上级窗口的JS window

Js/Jquery获取iframe中的元素 在Iframe中获取父窗体的元素方法

在web开发中,经常会用到iframe,难免会碰到需要在父窗口中使用iframe中的元素.或者在iframe框架中使用父窗口的元素 js 在父窗口中获取iframe中的元素  1. 格式:window.frames["iframe的name值"].document.getElementByIdx_x("iframe中控件的ID").click(); 实例:window.frames["ifm"].document.getElementByIdx_

使用jquery获取iframe内的元素属性

当需要获取iframe里的内容时需要有几个前提,否则你是获取不到的: 1:当前页面与iframe的src的页面需要在同一个域名下: 2:必须要等iframe里边的页面加载完成才能获取,否则你要获取的标签就是不存在: 当这两个条件都满足的时候你就可以获取了(以下例子是本精灵通过jquery修改iframe(" iframe的ID名被取为了iframeName'")里页面的所有a标签的target属性值): function a_load(){ var isOnLoad = true; $

Js/Jquery获取iframe中的元素

在web开发中,经常会用到iframe,难免会碰到需要在父窗口中使用iframe中的元素.或者在iframe框架中使用父窗口的元素. JavaScript 在父窗口中获取iframe中的元素 格式:window.frames["iframe的name值"].document.getElementById("iframe中控件的ID").click(); 实例:window.frames["ifm"].document.getElementById

js / jquery 获取和设置 FCK Editor 的值

开发中遇到 通过 $("#content").val(); 或者 document.getElementById("content"); 并不能获取到 id 为 content的值  $("#content").val(--赋值的信息--); 也不能为 id 为 content 赋值: 页面代码: <tr> <td class="p12">内容:</td> <td colspan=&q

js中获取input中所输入的值

<script type="text/javascript"> function huoqu(){ var G=document.getElementById('value').value; alert(G); } </script> <body> <div class="containter"> <div class="row"> <div class="md-col-