位置:首頁 > 軟件操作教程 > UI設(shè)計軟件 > Adobe Dreamweaver > 問題詳情

Dreamweaver做一個登陸頁面,只一個用戶,密碼輸入后能直接到指定頁面

提問人:李娟發(fā)布時間: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>無標(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("用戶名或密碼不能為空??!");
 }
else{
 if(name=="demo" && pass=="demo321"){
 alert("登錄成功!");
 //這里寫你頁面跳轉(zhuǎn)的語句  
 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>

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部