怎样用html在线编辑器,编辑已有文件
tmyu 2003-08-07 04:03:32 我做了个简单的在线编辑器,请问如果我添加一个文件后,想编辑它,该怎样实现
以下是编辑器源码,
<HTML>
<HeAD>
<TITLe>在线编辑器</TITLe>
</HeAD>
<script>
var range;
function newline()
{
editor.focus();
range = editor.document.selection.createRange();
range.text=edit.text+"\n";
editor.focus();
}
function bold()
{
editor.focus();
range = editor.document.selection.createRange();
range.execCommand("Bold");
editor.focus();
}
function save()
{
document.message.msg.value=editor.document.body.innerHTML;
}
function initeditor()
{
editor.document.open();
editor.document.write(initHTML);
editor.document.close();
initHTML = "";
}
</script>
<BODY>
<iframe id="editor" width="300", height="200" >
</iframe>
<script>
editor.document.designMode="On";
</script>
<FORM name="message" MeTHOD=POST ACTION="pic/tes.php">
<INPUT TYPe="hidden" name="msg" value="">
<INPUT TYPe="checkbox" NAMe="bb" onclick="bold()">
<INPUT TYPe="submit" name="submit" value="确定" onclick="save()">
</FORM>
</BODY>
</HTML>