javascript 表單的友好用戶體現(xiàn)
更新時間:2009年01月07日 23:30:10 作者:
javascript 表單的友好用戶體現(xiàn)代碼
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>test</title>
<script language="javascript" type="text/javascript">
function validateLength(obj)
{
return obj.value.length < obj.getAttribute("maxlength");
}
</script>
</head>
<body>
<label for="userName">用戶名:</label>
<input id="userName" type="text" maxlength="10" onmouseover="this.focus();" onfocus="this.select();" /><br /><br />
<label for="passWord">密碼 :</label>
<input id="passWord" type="password" onmouseover="this.focus();" onfocus="this.select();" /><br /><br />
<label for="remark">備注 :</label>
<textarea id="remark" onkeypress="return validateLength(this);" onmouseover="this.focus();" onfocus="this.select();" maxlength="50" cols="50" rows="5"></textarea>
</body>
</html>
<head>
<title>test</title>
<script language="javascript" type="text/javascript">
function validateLength(obj)
{
return obj.value.length < obj.getAttribute("maxlength");
}
</script>
</head>
<body>
<label for="userName">用戶名:</label>
<input id="userName" type="text" maxlength="10" onmouseover="this.focus();" onfocus="this.select();" /><br /><br />
<label for="passWord">密碼 :</label>
<input id="passWord" type="password" onmouseover="this.focus();" onfocus="this.select();" /><br /><br />
<label for="remark">備注 :</label>
<textarea id="remark" onkeypress="return validateLength(this);" onmouseover="this.focus();" onfocus="this.select();" maxlength="50" cols="50" rows="5"></textarea>
</body>
</html>
相關文章
JS實多級聯(lián)動下拉菜單類,簡單實現(xiàn)省市區(qū)聯(lián)動菜單!
JS實多級聯(lián)動下拉菜單類,簡單實現(xiàn)省市區(qū)聯(lián)動菜單!...2007-05-05用JAVASCRIPT如何給<textarea></textarea&
用JAVASCRIPT如何給<textarea></textarea>賦值...2007-04-04