标签:
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 else 10 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 break 19 default: 20 alert("fail"); 21 } 22 } 23 catch(err) 24 { 25 txt = err.message 26 alert(txt); 27 } 28 }
标签:
原文地址:http://www.cnblogs.com/liuyang92/p/5880304.html