• js单击自动选择文本


     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     2 <html>
     3 <head>
     4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
     5 <title>自动选择文本框/编辑框中的文字</title>
     6 <script type="text/javascript">
     7   function Myselect_txt(){
     8     if (document.form1.title.focus){
     9       document.form1.title.select();
    10 
    11     }
    12   }
    13   function Myselect_txtarea(){
    14     if (document.form1.content.focus){
    15       document.form1.content.select();
    16 
    17     }
    18   }
    19 </script>
    20 </head>
    21 <body style="font-size:12px">
    22   <table width="443" height="97" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f9f9f9">
    23     <form name="form1">
    24       <tr bgcolor="#214994">
    25         <td height="25" colspan="2"><div align="center"><font color="#FFFFFF">新闻信息修改</font></div></td>
    26       </tr>
    27       <tr>
    28         <td width="80" height="28"><div align="right"><font color="#214994">新闻标题:</font></div></td>
    29         <td width="363"><input name="title" type="text" size="50" value="今日新闻头条" onClick="Myselect_txt()"></td>
    30       </tr>
    31       <tr>
    32         <td height="20"><div align="right"><font color="#214994">新闻内容:</font></div></td>
    33         <td rowspan="2"><textarea name="content" cols="50" rows="6" onClick="Myselect_txtarea()">今日,据相关方面报道,...</textarea></td>
    34       </tr>
    35       <tr>
    36          <td height="10">&nbsp;</td>
    37       </tr>
    38       <tr>
    39          <td height="32" colspan="2">
    40            <div align="center">
    41               <input name="add" type="submit" id="add" value="添加">&nbsp;
    42               <input name="Submit" type="reset" value="重置">
    43             </div>
    44 
    45         </td>
    46       </tr>
    47     </form>
    48   </table>
    49 </body>
    50 </html>
  • 相关阅读:
    JS各种各样的拖动效果
    GridView实现自动编号
    通用海量数据库翻页
    设置首页和添加到收藏夹的JavaScript代码
    JavaScript弹出窗口总结
    JavaScript获取窗口的高度和宽度
    精妙SQL语句
    Javascript 操作select控件大全(新增、修改、删除、选中、清空、判断存在等)
    GridView数据导入Excel
    网站采集
  • 原文地址:https://www.cnblogs.com/xujiangli/p/5780616.html
Copyright © 2020-2023  润新知