contentWindow iframe的contentWindow属性 指定的frame或者iframe所在的window对象
2013-03-27 12:48
405 查看
contentWindow属性是指指定的frame或者iframe所在的window对象2006-12-23 09:39
在IE中iframe或者frame的contentWindow属性可以省略,但在Firefox中如果要对iframe对象进行编辑则
必须指定contentWindow属性。
function EnableEdit()
{
var editor;
editor = document.getElementById("HtmlEdit").contentWindow;
// 针对IE浏览器, make it editable
editor.document.designMode = 'On';
editor.document.contentEditable = true;
// For compatible with FireFox, it should open and write something to make it work
editor.document.open();
editor.document.writeln('<html><head>');
editor.document.writeln('<style>body {background: white;font-size:9pt;margin: 2px; padding: 0px;}</style>');
editor.document.writeln('</head><body></body></html>');
editor.document.close();
}
<iframe ID="HtmlEdit" MARGINHEIGHT="1" MARGINWIDTH="1" width="100%" height="312">
</iframe>
<html>
<body>
<script>
var ifr = document.createElement("iframe");
document.body.appendChild(ifr);
var ifrdoc = ifr.contentWindow.document;
var s = fixingHTB.innerHTML; //进入可编辑模式前存好
ifrdoc.designMode = "on"; //文档进入可编辑模式
ifrdoc.open(); //打开流
ifrdoc.write(s);
ifrdoc.close(); //关闭流
ifrdoc.designMode ="off"; //文档进入非可编辑模式
</script>
</body>
var frames=window.top.window.document.getElementById("rightframe");
frames.contentWindow.TshowMsg(msg,'');
在IE中iframe或者frame的contentWindow属性可以省略,但在Firefox中如果要对iframe对象进行编辑则
必须指定contentWindow属性。
function EnableEdit()
{
var editor;
editor = document.getElementById("HtmlEdit").contentWindow;
// 针对IE浏览器, make it editable
editor.document.designMode = 'On';
editor.document.contentEditable = true;
// For compatible with FireFox, it should open and write something to make it work
editor.document.open();
editor.document.writeln('<html><head>');
editor.document.writeln('<style>body {background: white;font-size:9pt;margin: 2px; padding: 0px;}</style>');
editor.document.writeln('</head><body></body></html>');
editor.document.close();
}
<iframe ID="HtmlEdit" MARGINHEIGHT="1" MARGINWIDTH="1" width="100%" height="312">
</iframe>
<html>
<body>
<script>
var ifr = document.createElement("iframe");
document.body.appendChild(ifr);
var ifrdoc = ifr.contentWindow.document;
var s = fixingHTB.innerHTML; //进入可编辑模式前存好
ifrdoc.designMode = "on"; //文档进入可编辑模式
ifrdoc.open(); //打开流
ifrdoc.write(s);
ifrdoc.close(); //关闭流
ifrdoc.designMode ="off"; //文档进入非可编辑模式
</script>
</body>
var frames=window.top.window.document.getElementById("rightframe");
frames.contentWindow.TshowMsg(msg,'');
相关文章推荐
- contentWindow iframe的contentWindow属性 指定的frame或者iframe所在的window对象
- [转]contentWindow属性是指指定的frame或者iframe所在的window对象
- contentWindow属性是指指定的frame或者iframe所在的window对象
- contentWindow属性是指指定的frame或者iframe所在的window对象
- iframe.contentWindow 属性:关于contentWindow和contentDocument区分
- frame或者iframe的contentwindow属性
- 各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试
- 【javascript基础】各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试 【转】
- 各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试
- 各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试
- 转-IE6 & IE7 动态创建 iframe 读取不到 contentWindow.name 属性解决方案
- from表单传值到页面,并在iframe中显示该页面,通过form的target属性指定iframe
- Javascript里,把URL发给指定的iframe或frame
- iframe父子兄弟之间调用传值(contentWindow && parent)
- 各浏览器Iframe对contentWindow、contentDocument、、的测试
- 解决在项目里引入Spring Security后iframe或者frame所引用的页无法显示的问题
- iframe.contentWindow 介绍
- iframe父子兄弟之间调用传值(contentWindow && parent)
- window.frameElement属性
- javascript 控制frame,iframe的src属性