javascript 表单的友好用户体现
javascript 表单的友好用户体现
发布时间:2016-12-30 来源:查字典编辑
摘要:testfunctionvalidateLength(obj){returnobj.value.length

<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>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类