jquery对iframe支持不好的解决办法
来源:互联网 发布:高压电缆打压试验数据 编辑:程序博客网 时间:2024/04/30 15:51
再次发现jQuery 对iframe操作支持不好!不过结合javascript的dom可以解决问题
在线演示
demo.html
在线演示
demo.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>demo</title>
<script src="http://demo.deeka.cn/limit2checked/jquery-1.2.6.pack.js"></script>
<script>
<!--
$(function(){
$("#code").click(function(){
//alert(document.getElementById('ifr').contentWindow.document.body.innerHTML);
alert($(document.getElementById('ifr').contentWindow.document.body).html());
});
$("#btn").click(function(){
$(document.getElementById('ifr').contentWindow.document.body).html($(this).html());
});
$("#img").click(function(){
$(document.getElementById('ifr').contentWindow.document.body).html("<img src='http://www.lanrentuku.com/images/uppic/20080324175817.jpg' />");
});
});
-->
</script>
</head>
<body><iframe id="ifr" name="ifr" src="iframe.html" style="width:300px; height:200px; border:#CCCCCC solid 1px;"></iframe>
<p id="btn" style="cursor:pointer">把我写进<b>iframe</b>里面去</p>
<p id="img" style="cursor:pointer">插入图片</p>
<p id="code" style="cursor:pointer">查看源码</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>demo</title>
<script src="http://demo.deeka.cn/limit2checked/jquery-1.2.6.pack.js"></script>
<script>
<!--
$(function(){
$("#code").click(function(){
//alert(document.getElementById('ifr').contentWindow.document.body.innerHTML);
alert($(document.getElementById('ifr').contentWindow.document.body).html());
});
$("#btn").click(function(){
$(document.getElementById('ifr').contentWindow.document.body).html($(this).html());
});
$("#img").click(function(){
$(document.getElementById('ifr').contentWindow.document.body).html("<img src='http://www.lanrentuku.com/images/uppic/20080324175817.jpg' />");
});
});
-->
</script>
</head>
<body><iframe id="ifr" name="ifr" src="iframe.html" style="width:300px; height:200px; border:#CCCCCC solid 1px;"></iframe>
<p id="btn" style="cursor:pointer">把我写进<b>iframe</b>里面去</p>
<p id="img" style="cursor:pointer">插入图片</p>
<p id="code" style="cursor:pointer">查看源码</p>
</body>
</html>
http://hi.baidu.com/linjk03/blog/item/8a1cef388f2da92fb8998f5a.html
- jquery对iframe支持不好的解决办法
- poi的autoSizeColumn方法对全角或者说中文支持不好的一个解决办法
- poi的autoSizeColumn方法对全角或者说中文支持不好的一个解决办法
- poi的autoSizeColumn方法对全角或者说中文支持不好的一个解决办法
- WinXP 对Sis900网卡的支持不好
- iframe对透明的支持
- IE对SVG支持不好
- Django对ajax支持不好?
- 对iFrame 自适应高度的解决办法
- 解决Boost.Regex对中文支持不好的问题
- Sun的JDK对尾递归支持不好
- 解决Boost.Regex对中文支持不好的问题收藏
- 解决Boost.Regex对中文支持不好的问题
- 解决Boost.Regex对中文支持不好的问题
- delphi 的 pos 函数 对中文支持不好。
- 解决Boost.Regex对中文支持不好的问题
- gdal库对ENVI文件的一点支持不好
- IOS系统对position:fixed支持不好的解决方法
- 【转】浅析UPnP协议热
- 新人报到
- poj 1082 Calendar Game
- balabala
- [推荐]线上内衣工场
- jquery对iframe支持不好的解决办法
- 单子设计模式解析(Singleton Pattern)
- 换一种js包含的方式,让javascript加载速度倍增
- linux 配置和命令
- 新员工导师制
- 开通自己的博客了
- 学会的,笔记……
- St. Louis Rams aswell afresh bidding interest
- SAP HONG KONG PARTNERS-CONSULTING PARTNERS