<script type="text/javascript">
function login() {
if (trim(document.getElementById("username").value) == "") {
alert("用户名不能为空!");
document.getElementById("username").focus();
return;
}
if (trim(document.getElementById("password").value) == "") {
alert("密码不能为空!");
document.getElementById("password").focus();
return;
}
with (document.getElementById("userForm")) {
method = "post";
action = "user/login.do?command=login";
submit();
}
}
</script>
</head>
<body>
<center>
<h1>登陆</h1>
<hr>
<form name="userForm" id="userForm">
用户:<input type="text" name="username" id="username"><br>
密码:<input type="password" name="password" id="password"><br>
<input name="btnLog" type="button" id="btnLog" value="登陆" onclick="login()">
<input type="reset" value="取消"><br>
<a href=user/registerinput.do>还没用户名,注册一个吧!</a>
</form>
<p>
</center>
</body>
function login() {
if (trim(document.getElementById("username").value) == "") {
alert("用户名不能为空!");
document.getElementById("username").focus();
return;
}
if (trim(document.getElementById("password").value) == "") {
alert("密码不能为空!");
document.getElementById("password").focus();
return;
}
with (document.getElementById("userForm")) {
method = "post";
action = "user/login.do?command=login";
submit();
}
}
</script>
</head>
<body>
<center>
<h1>登陆</h1>
<hr>
<form name="userForm" id="userForm">
用户:<input type="text" name="username" id="username"><br>
密码:<input type="password" name="password" id="password"><br>
<input name="btnLog" type="button" id="btnLog" value="登陆" onclick="login()">
<input type="reset" value="取消"><br>
<a href=user/registerinput.do>还没用户名,注册一个吧!</a>
</form>
<p>
</center>
</body>
if (document.getElementById("username").value.trim() == "") {
alert("用户名不能为空!");
document.getElementById("username").focus();
return;
} if (document.getElementById("password").value.trim() == "") {
alert("密码不能为空!");
document.getElementById("password").focus();
return;
}
alert("用户名不能为空!");
document.getElementById("username").focus();
return;
}if (document.getElementById("password").value.trim() == "") {
alert("密码不能为空!");
document.getElementById("password").focus();
return;
}