IFrame 获取内容
试试:
iframe.contentwindow.document.documentElement.innerHTML
document.getElementById("MyIFrame").contentDocument.getElementById("s").style.color="blue"; 详细代码如下:
TestIFrame.htm: <html>
<head>
<script type="text/javascript">
function f(){
var doc; if (document.all){//IE
doc = document.frames["MyIFrame"].document;
}else{//Firefox
doc = document.getElementById("MyIFrame").contentDocument;
} doc.getElementById("s").style.color="blue";
}
</script>
</head>
<body onload="f()"> <iframe id = "MyIFrame" name = "MyIFrame" src = "MyIFrame.htm" width = "100" height="100"> </body>
</html> MyIFrame.htm: <h1 id = "s" style="color:red;" >内容<h1>
IFrame 获取内容的更多相关文章
- espcms列表页ajax获取内容 - 并初始化swiper
<link rel="stylesheet" href="swiper.min.css" type="text/css" media= ...
- php发送get、post请求获取内容的几种方法
方法1: 用file_get_contents 以get方式获取内容 <?php $url='http://www.domain.com/'; $html = file_get_contents ...
- jquery获取内容和属性的方法
通过jquery如何捕获文本内容和属性? text(),html(),val()及attr(). attr()更具有普遍性,元素text属性和表单value属性,可以通过attr()操作. <! ...
- iframe获取元素
原生js在网页中,父元素获取iframe中的元素: window.onload=function () { 例如: console.log(window.frames["iframe的nam ...
- Python3从零开始爬取今日头条的新闻【四、模拟点击切换tab标签获取内容】
Python3从零开始爬取今日头条的新闻[一.开发环境搭建] Python3从零开始爬取今日头条的新闻[二.首页热点新闻抓取] Python3从零开始爬取今日头条的新闻[三.滚动到底自动加载] Pyt ...
- WordPress主题开发:通过page的ID或者别名获取内容
访问地址:xx/?page_id=12 如果是在当前页面,只需要通过循环就可以输出对应的信息 <?php if(have_posts()):while(have_posts()):the_pos ...
- jquery尺寸和jQuery设置和获取内容方法
一.jquery尺寸 jQuery 提供多个处理尺寸的重要方法: width() 设置或返回元素的宽度(不包括内边距.边框或外边距),括号中可填数值宽度参数,无单位 height() 设置或 ...
- jquery库实现iframe自适应内容高度和宽度
javascript原生和jquery库实现iframe自适应内容高度和宽度---推荐使用jQuery的代码! <iframe src="index.php" id=&qu ...
- iOS UIWebView 获取内容实际高度,关闭滚动效果
本文转载至 http://my.oschina.net/Khiyuan/blog/341535 iOS UIWebView 获取内容实际高度,关闭滚动效果 近期做东西,将 UIWebView 嵌套 ...
随机推荐
- 11 自定制shell提示符
shell提示符 huiubantu@ubuntu:~$ shell提示符保存在PS1变量中 包括用户名,主机名,当前工作目录 可以通过echo命令查看PS1的内容 huiubantu@ubuntu ...
- Github注册流程和使用体验
大家好,我叫施蓓蓓,学号1413042063,在网络工程143班,我的兴趣爱好有很多,特别是在专业方面,比如软件工程.操作系统.网络通信技术.计算机组成原理等,我对游戏十分感兴趣,以后就业会朝这方面发 ...
- es根据磁盘使用情况来决定是否分配shard
注意两个地方说法有出入,待实测! es可以根据磁盘使用情况来决定是否继续分配shard.默认设置是开启的,也可以通过api关闭:cluster.routing.allocation.disk.thre ...
- Xwindow 连接 RHEL 5
cd /etc/gdm/custom.conf ----------------------------------------- [security] AllowRemoteRoot=true [x ...
- bzoj 1911: [Apio2010]特别行动队
#include<cstdio> #include<iostream> #define M 1000009 #define ll long long using namespa ...
- elasticsearch插件之一:bigdesk
bigdesk是elasticsearch的一个集群监控工具,可以通过它来查看es集群的各种状态,如:cpu.内存使用情况,索引数据.搜索情况,http连接数等. 可用项目git地址:https:// ...
- Oracle连接出现TNS:no listener或者ORA-12514: TNS:listener does not currently know
1.Message 850 not found; No message file for product=network, facility=NL 提示框:TNS:no listener 解决办法: ...
- .className = "highlight";.setAttribute("class", "highlight");
document.getElementById("top").innerHTML = newHTML; document.getElementById("contact& ...
- 构建者模式(Builder)示例代码
package com.test; /** * Created by xiaonanhai on 2015/5/30. */ public class Builder { private String ...
- android之DOM生成与解析
DOM解析不适合于进行大数据文件的操作,DOM解析适合于对文件进行修改和随机存取的操作. DOM生成 //判断一下是否存在sdcard if(!Environment.getExternalStora ...