1
0
Fork 0
php-coding/11.work1.login.php

50 lines
1.4 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>试用版学习资源网 登录</title>
</head>
<body>
<form method="post" action="11.work1.auth.php">
<table>
<tr>
<th colspan="2" style="text-align: center">
<h1>用户登录</h1>
</th>
</tr>
<tr>
<td>
<label for="username1">用户名</label>
</td>
<td>
<input type="text" id="username1" name="username" required>
</td>
</tr>
<tr>
<td>
<label for="password1">密码</label>
</td>
<td>
<input type="password" name="password" id="password1" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value="登录" name="submit" id="submit1" onclick="return check()">
<input type="reset" value="重置" name="reset" id="reset1">
</td>
</tr>
</table>
</form>
<script>
function check(){
//check username and password empty
const username = document.getElementById("username1").value;
const password = document.getElementById("password1").value;
if(username === "" || password === ""){
alert("用户名或密码不能为空!");
return false;
}
}
</script>
</body>