HTML登录验证

<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>

<script language="javascript" type="text/javascript">
	var obj={
		valid:function(){
			var txt1 = document.getElementById("txt1");
			alert(txt1.KeyError);
			return obj.false;
		}
	}
</script>

<body>
	<form name ="form1" method="post">
		<table width="300" border="1px" cellpadding="0px" cellspacing="0px" align="center">
			<tr >
				<td colspan="2" align="center">用户登录</td>
			</tr>
			<tr>
				
				<td><label for="txt1">用户名:<label></td>
				<td><input id="txt1" name="txt1" onblur="if(this.value.length<4||this.value.length>10) {alert(KeyError);}"

				KeyError="密码至少为4-10位" type="text"/></td>
			</tr>
		</table>
	</form>
 </body>
</html>

你可能感兴趣的:(HTML登录验证)