|
|
|
在线编辑器基础知识大杂烩
作者:佚名 来源:一亩三分地 点击: 日期:2007-03-23 |
|
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>
|
|
|
|
【文章评论】
【收藏本文】
【推荐好友】
【打印本文】
【论坛讨论】 |
相关文章: |
|
|
文章评论:(条) |
|
|
|
|
责任编辑:一分 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。 |
|