<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script type="text/javascript">
function checkText(){
 var name = document.getElementById("name").value;
 var passwd = document.getElementById("passwd").value;
 if(name == "") {
  alert("用户名不能为空!");
  //elem.focus();
  return false;
 }
 if(passwd.length < 6){
  alert("密码长度太短,长度必须大于6!");
  //elem.focus();
  return false;
 }
 return true;
}
</script>
</head>

<body>
<form name="form1" method="post" action="">
用户名:<input type="text" name="name" id="name" onBlur="return checkText()"><br/>
密 码:<input type="password" name="passwd" id="passwd" onBlur="return checkText()"><br/>
    <input type="submit" name="Submit" value="提交">&nbsp;
    <input type="submit" name="Submit2" value="重置" onClick="reset()">
</form>
</body>
</html>