<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
input,textarea{
margin-bottom:4px;
border:1px solid #099;
}
span{
color:#CCC;
}
</style>
<script>
function check_pw_length(value)
{
var para=document.getElementById("demo");
if(value.length<6)
{
para.innerHTML="(您设置的密码长度有误,请检查后重新输入!)";
para.style.color="#F00";
}
else
{
para.innerHTML="(您设置的密码正确!)";
para.style.color="#0F0";
}
}
</script>
</head>
<body>
<label>
姓 名:<input type="text" /><br />
</label>
<label>
密 码:<input type="password" onBlur="check_pw_length(this.value)"/>
<span id="demo" style="font-family:'Courier New', Courier, monospace;">(密码最低长度为6位)</span>
<br />
</label>
个人简介:<br />
<textarea cols="20" rows="4">
</textarea>
</label>
</body>
</html>
利用JavaScript DOM 检查表单
最新推荐文章于 2021-11-28 18:18:20 发布