<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> 基本表单提交</title>
</head>
<body>
<form action="/server_url" method="post" onsubmit="return beforeSubmit()">
用户:<input id="username" type="text" name="username" />
密码:<input id="password" type="password" name="password" />
<input type="submit" value="提交" />
</form>
<script type="text/javascript">
function beforeSubmit() {
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;
if (username.length < 6 || password.length < 6) {
alert('格式不正确!');
return false;
} else {
return true;
}
}
</script>
</body>
</html>
<HTML>
<head>
<title>数字</title>
</head>
<body>
<p>11111111111111111111111111</p><br/>
<p>2222222222222222222222</p><br/>
</body>
</HTML>