---
title: "Html编辑器基础 "
author: "vefan"
date: "2010-02-21T16:44:14Z"
tags: []
categories: ["Web前端"]
slug: "html"
draft: false
lastmod: "2010-02-21T16:44:14Z"
id: 599604
url: "https://vefan.iteye.com/blog/599604"
---

```html

<!--兼容FF、IE7-->

<div style="height:300px; width:600px; border:1px solid #000000">
<iframe id="HtmlEditor" src="" frameborder="0" marginheight="0" marginwidth="0" style="width:100%; height:100%;">d</iframe>
<br><br>
</div>
<script type="text/javascript">
window.onload = function () {
    var f = document.getElementById("HtmlEditor");
    var html = '<HEAD></HEAD><BODY><div></div></BODY>';
    f.contentWindow.document.open("text/html", "replace");
    f.contentWindow.document.write(html);
    f.contentWindow.document.close();
    f.contentWindow.document.designMode = "on";
}
</script> 


```