<!---今天主要是复习了标题和段落--->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JS脚本实现用户登录页面</title>
<meta charset="UTF-8">
<script>
function r() {
var username = document.getElementById("username");
var pass = document.getElementById("password");
if (username.value == "") {
alert("请输入用户名");
username.focus();
return;
}
if (pass.value == "") {
alert("请输入密码");
return;
}
return true;
}
</script>
</head>
<body>
<form>
<table width="350" bgcolor="#ccffcc" border="1">
<tr align=center>
<td>用户名</td>
<td><input type="text" name="username" id="username"></td>
</tr>
<tr align=center><td>密 码</td><td><input type="password" name="password" id="password"></td></tr>
<tr align=center><td>验证码</td><td><input type="text" name="yanzheng"></td></tr>
<tr align=center><td colspan="2"><input type="button" value="登 录" οnclick="r();" /> <input type="reset" value="重 置" /></td></tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JS脚本实现用户登录页面</title>
<meta charset="UTF-8">
<script>
function r() {
var username = document.getElementById("username");
var pass = document.getElementById("password");
if (username.value == "") {
alert("请输入用户名");
username.focus();
return;
}
if (pass.value == "") {
alert("请输入密码");
return;
}
return true;
}
</script>
</head>
<body>
<form>
<table width="350" bgcolor="#ccffcc" border="1">
<tr align=center>
<td>用户名</td>
<td><input type="text" name="username" id="username"></td>
</tr>
<tr align=center><td>密 码</td><td><input type="password" name="password" id="password"></td></tr>
<tr align=center><td>验证码</td><td><input type="text" name="yanzheng"></td></tr>
<tr align=center><td colspan="2"><input type="button" value="登 录" οnclick="r();" /> <input type="reset" value="重 置" /></td></tr>
</table>
</form>
</body>
</html>