<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>User Login</title>
<style type="text/css">
<!—
.alert {color: red}
.textinput {width:160px}
.btn {width:80px}
table {border: 3px double;background-color:#eeeeee;}
-->
</style>
<script language="javascript">
<!--
function doCheck(){
if(document.frmLogin.username.value==""){
alert('请输入你的用户名!');
return false;
}
if(document.frmLogin.password.value==""){
alert('请输入你的密码!');
return false;
}
}
-->
</script>
</head>
<body>
<form name="frmLogin" method="post" action="login.php" onSubmit="return doCheck();">
<table border="0" cellpadding="8" width="350" align="center">
<tr><td colspan="2" align="left" class="alert">用户名:</td>
<td><input name="username" type="text" id="username" class="textinput" /></td>
</tr>
<tr><td colspan="2" align="left" class="alert">密码:</td>
<td><input name="password" type="password" id="password" class="textinput" /></td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" class="btn" value="登录">
<input type="reset" class="btn" value="重置"></td>
</tr>
</form>
</body>
</html>
转载于:https://my.oschina.net/ajian2014/blog/324436