表單的友好用戶體現

  1. <html xmlns="http://www.w3.org/1999/xhtml" >
  2. <head>
  3.     <title>test</title>
  4.     <script language="javascript" type="text/javascript">
  5.         function validateLength(obj)
  6.         {
  7.             return obj.value.length < obj.getAttribute("maxlength");
  8.         }
  9.     </script>
  10. </head>
  11. <body>
  12.     <label for="userName">用戶名:</label>
  13.     <input id="userName" type="text" maxlength="10" onmouseover="this.focus();" onfocus="this.select();" /><br /><br />
  14.     
  15.     <label for="passWord">密碼  :</label>
  16.     <input id="passWord" type="password" onmouseover="this.focus();" onfocus="this.select();" /><br /><br />
  17.     
  18.     <label for="remark">備註  :</label>
  19.     <textarea id="remark" onkeypress="return validateLength(this);" onmouseover="this.focus();" onfocus="this.select();" maxlength="50" cols="50" rows="5"></textarea>
  20. </body>
  21. </html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章