<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<style>
.one{
border:1px solid
width:300px
height:20px
background-image:url("photos/3jpg");
}
</style>
<script type="text/javascript">
/* function fun(){
document.getElementById("p").className="one";
}
function fun2(){
document.getElementById("a").innerHTML="<font corlor='#00ffff'>欢迎光临</font>";
}*/
function fun3(){
var v = document.getElementById("name").value;
if(v=="")
{
document.getElementById("n").innerHTML="<font color='red' size='2'>*姓名为空,请重新填写姓名</font>";
}
else if(v.length<6){
document.getElementById("n").innerHTML="<font color='red' size='2'>*姓名长度不够</font>";
}
}//姓名为空和长度检测
function fun4(){
var v = document.getElementById("password").value;
if(v==""){
document.getElementById("p").innerHTML="<font color='red' size='2'>*密码为空,请重新填写密码</font>";
}
else if(v.length<6 || v.length>12){
document.getElementById("p").innerHTML="<font color='red' size='2'>*密码长度超出范围</font>";
}
}//密码为空和长度检测
function fun5(){
var v = document.getElementById("age").value;
if(v==""){
document.getElementById("a").innerHTML="<font color='red' size='2'>*年龄为空,请重新填写年龄</font>";
}
else if(v<0 || v>12){
document.getElementById("a").innerHTML="<font color='red' size='2'>*密码长度超出范围</font>";
}
}//密码为空和长度检测
</script>
<body>
<form method="post" action="">
姓名:<input type="text" name="name" id="name" ><span id="n"></span>
<input type="button" value="检测" onclick="fun3()"></br>
密码:<input type="password" name="password" id="password"><span id="p"></span> <input type="button" value="检测" onclick="fun4()"></br>
年龄:<input type="text" name="age" id="age"><span id="a"></span>
<input type="button" value="检测" onclick="fun5()">
</br>
<div id="a""></div>
</form>
</body>
</html>。