|
|
在线编辑器基础知识大杂烩 |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
designMode应用: 使一个子框架可编辑:(on可编辑,off取消编辑,注:designMode初始默认值是Inherit,而非off) <HTML> <HEAD> <TITLE></TITLE> <script language="javascript">
function test() { var targetdoc=document.frames(0).document; if(targetdoc.designMode=="Off") { targetdoc.designMode="On"; } else { targetdoc.designMode="Off"; } } </script> </HEAD> <BODY> <INPUT type="button" value="Button" id=button1 name=button1 onclick="test()"> <iframe src="C.htm" style="border:black thin;width:200px;height:200px"></iframe> </BODY> </HTML> ------------------------------------ 使span可编辑:
<HTML> <HEAD> <TITLE></TITLE> <script language="javascript"> function test() { if(myspan.isContentEditable==true) { myspan.contentEditable=false; } else { myspan.contentEditable=true; } } </script> </HEAD> <BODY> <INPUT type="button" value="Button" id=button1 name=button1 onclick="test()"> <span contenteditable id=myspan style="border:1px solid black;width:200px;height:200px"></span> </BODY> </HTML> ----------------------------------------- 粗体、斜体、下划线 <Button id=btnBold onclick="document.execCommand('Bold');"><b>粗体</b></Button> <Button id=btnItalic onclick="document.execCommand('Italic');"><I>斜体</I></Button> <Button id=btnBold onclick="document.execCommand('Underline');"><u>下划线</u></Button>

|
|
相关文章:相关软件: |
|