Dreamweaver做一个登陆页面,只一个用户,密码输入后能直接到指定页面
提问人:李娟发布时间:2020-09-16
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function checkLogon(){
var name = document.getElementById("username").value;
var pass = document.getElementById("password").value;
//判断非空
if((name==null || name=="") || (pass==null || pass=="")){
alert("用户名或密码不能为空!!");
}
else{
if(name=="demo" && pass=="demo321"){
alert("登录成功!");
//这里写你页面跳转的语句
window.location.href="http://www.baidu.com/";
}
else{
alert("用户名或密码错误!!");
}
}
}
</script>
</head>
<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25">用户名</td>
<td><input name="textfield" type="text" size="14" id="username"></td>
</tr>
<tr>
<td height="25">密码</td>
<td><input name="textfield2" type="text" size="14" id="password"></td>
</tr>
<tr>
<td height="25" colspan="2"><div align="center">
<input type="submit" name="Submit" value="登录" onClick="checkLogon()">
</div></td>
</tr>
</table>
</body>
</html>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function checkLogon(){
var name = document.getElementById("username").value;
var pass = document.getElementById("password").value;
//判断非空
if((name==null || name=="") || (pass==null || pass=="")){
alert("用户名或密码不能为空!!");
}
else{
if(name=="demo" && pass=="demo321"){
alert("登录成功!");
//这里写你页面跳转的语句
window.location.href="http://www.baidu.com/";
}
else{
alert("用户名或密码错误!!");
}
}
}
</script>
</head>
<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25">用户名</td>
<td><input name="textfield" type="text" size="14" id="username"></td>
</tr>
<tr>
<td height="25">密码</td>
<td><input name="textfield2" type="text" size="14" id="password"></td>
</tr>
<tr>
<td height="25" colspan="2"><div align="center">
<input type="submit" name="Submit" value="登录" onClick="checkLogon()">
</div></td>
</tr>
</table>
</body>
</html>
继续查找其他问题的答案?
相关视频回答
回复(0)
点击加载更多评论>>