Zhlw.com - 中华龙网

站长资讯通告:
搜索: 您的位置中华龙网 > 计算机网络 > 网络编程 > JSP/JavaScript > 文章列表

对textarea中的内容,进行选中后,加效果

作者:bear  来源:转载  发布时间:2005-11-11 9:06:11
此效果可以用在Ubb论坛中。
<script language="JavaScript">
 <!--
 function bold(){
  Qr=document.selection.createRange().text;
 if(!Qr || document.selection.createRange().parentElement().name!='description'){
   txt=prompt('Text to be made BOLD.','');
   if(txt!=null && txt!='')document.form1.description.value+=''+txt+'';
  }else{
 document.selection.createRange().text=''+document.selection.createRange().text+'';
   document.selection.empty();
  }
 }
 //-->
 </script>
 <form name="form1">
 <input type="button" value="加粗" />
 <textarea name="description">选中我,点击加粗
 

        用户名: 验证码: 验证码,看不清楚?请点击刷新验证码 (注“”为必填内容。)


文章评论: [ 查看全部 ] 网友评论
关于本站 - 网站帮助 - 广告合作 - 友情连接 - 网站地图