標籤:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> 5 <title>TBUSF System</title> 6 <script type="text/javascript" src="./html_api.js"></script> 7 8 </head> 9 10 <body style="background-color:gray;padding: 20px;">11 12 <!--頁面標題-->13 <h1 style="text-align:center;color:yellow">welcome to TBUSF System</h1><br />14 15 <!--使用者登陸-->16 <p1 style="color:black">使用者User Name:</p1><br />17 <input id="user_id" tyle="text-align:center" type="text" name="username"><br />18 <p1 style="color:black">Code:</p1><br />19 <input id="code_id" type="text" name="code">20 <br><br>21 22 <!--點擊進入下一個頁面-->23 <input style="font-size:15px;" type="button" onclick="jump_page(‘user_id‘,‘code_id‘)" value="next page->">24 25 </body>26 </html>
./html_api.js(點擊登陸所調用函數):
1 function jump_page(id_x,id_y) 2 { 3 try 4 { 5 x=document.getElementById(id_x).value; 6 y=document.getElementById(id_y).value; 7 if (x == ‘劉洋‘ && y == ‘1992‘) 8 n =1; 9 else10 n = 3;11 switch (n)12 {13 case 1:14 window.open(‘https://www.baidu.com‘);15 break;16 case 2:17 window.location.href=‘https://www.baidu.com‘;18 break19 default:20 alert("fail"); 21 }22 }23 catch(err)24 {25 txt = err.message26 alert(txt);27 }28 }
網頁登陸架構代碼