鹿我所录的博客

记录我在学习C#中的点点滴滴,记录下以备后来人借鉴。

 

iframe可编辑 --- > 看看怎么设计

iframe可编辑

   实现iframe可编辑用到 document.designMode='on'(允许编辑)

 1.


<body onload="f.document.designMode='on'">
 
<iframe id="f"></iframe>
 <button onclick="f.document.body.innerHTML=''">清空</button>
 <button onclick="alert(f.document.documentElement.outerHTML)">代码</button>
</body>

 

2. frames :获取给定文档定义或与给定窗口关联的文档定义的所有 window 对象的集合(取得window对象集合)


<iframe id="if"></iframe>
<button onclick="window.frames.f.document.body.innerHTML=''">清空</button>
<button onclick="alert(window.frames.f.document.documentElement.outHTML)">输出 代码</button>

<script>
  window.frames.f.document.designMode
='on';
</script>

 

posted on 2011-08-09 13:59  鹿我所录  阅读(2894)  评论(0编辑  收藏  举报

导航