Dreamweaver做一個(gè)登陸頁(yè)面,只一個(gè)用戶(hù),密碼輸入后能直接到指定頁(yè)面
提問(wèn)人:李娟發(fā)布時(shí)間: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>無(wú)標(biāo)題文檔</title>
<script>
function checkLogon(){
var name = document.getElementById("username").value;
var pass = document.getElementById("password").value;
//判斷非空
if((name==null || name=="") || (pass==null || pass=="")){
alert("用戶(hù)名或密碼不能為空?。?quot;);
}
else{
if(name=="demo" && pass=="demo321"){
alert("登錄成功!");
//這里寫(xiě)你頁(yè)面跳轉(zhuǎn)的語(yǔ)句
window.location.href="http://www.baidu.com/";
}
else{
alert("用戶(hù)名或密碼錯(cuò)誤!!");
}
}
}
</script>
</head>
<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25">用戶(hù)名</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>無(wú)標(biāo)題文檔</title>
<script>
function checkLogon(){
var name = document.getElementById("username").value;
var pass = document.getElementById("password").value;
//判斷非空
if((name==null || name=="") || (pass==null || pass=="")){
alert("用戶(hù)名或密碼不能為空?。?quot;);
}
else{
if(name=="demo" && pass=="demo321"){
alert("登錄成功!");
//這里寫(xiě)你頁(yè)面跳轉(zhuǎn)的語(yǔ)句
window.location.href="http://www.baidu.com/";
}
else{
alert("用戶(hù)名或密碼錯(cuò)誤!!");
}
}
}
</script>
</head>
<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25">用戶(hù)名</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>
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>