javascript 表单的友好用户体现
程序员文章站
2022-06-29 09:04:34
<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>
上一篇: 蔬菜储藏的时候注意事项
下一篇: 眼疼吃什么好,有哪些食物可以预防眼睛近视