asfman
android developer
posts - 90,  comments - 213,  trackbacks - 0
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>
posted on 2006-04-03 15:34 汪杰 阅读(146) 评论(0)  编辑 收藏 引用 所属分类: hengxing网站js
只有注册用户登录后才能发表评论。

<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用链接

留言簿(15)

随笔分类(1)

随笔档案(90)

文章分类(727)

文章档案(712)

相册

收藏夹

http://blog.csdn.net/prodigynonsense

友情链接

最新随笔

搜索

  •  

积分与排名

  • 积分 - 459293
  • 排名 - 6

最新随笔

最新评论

阅读排行榜

评论排行榜