首页 > 代码库 > H5-页面跳转

H5-页面跳转

技术分享
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Title</title>
 6     <style>
 7         form
 8         {
 9             width:500px;
10             margin: 50px auto;
11         }
12         a
13         {
14             text-decoration: none;
15         }
16     </style>
17 </head>
18 <body>
19         <form action="denglu3.html">
20             用户名:<input type="text" id="ming"><br><br>
21             密 码:<input type="password" id="pw"><br><br>
22             记住密码:<input type="checkbox" id="chbox"><br><br>
23             <button id="bt">登录</button>
24         </form>
25     <script src="cookie封装.js"></script>
26 <script >
27     var ming=document.getElementById(ming);
28     var pw=document.getElementById(pw);
29     var chbox=document.getElementById(chbox);
30     var bt=document.getElementById(bt);
31 
32     if(getCookie(pass)){//判断cookie中含有密码
33         ming.value=getCookie(user);
34         pw.value=getCookie(pass);
35         chbox.checked=true;
36     }
37 
38     bt.onclick=function () {
39         var time=new Date();
40         var day=time.getMonth()+1++time.getDate()+;//获取时间
41         var x=ming.value;
42         setCookie(user,x,7);
43         setCookie(time,day,7);
44         if(chbox.checked){
45             setCookie(pass,pw.value,7);
46         }else{
47             removeCookie(pass);
48         }
49     }
50 </script>
51 </body>
52 </html>
page1.html
技术分享
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Title</title>
 6     <style>
 7         div
 8         {
 9 
10         }
11     </style>
12 </head>
13 <body>
14     <div id="con"></div>
15     <script src="cookie封装.js"></script>
16 <script >
17     con.innerHTML=欢迎+getCookie(user)+,当前登陆时间是:+getCookie(time);
18 </script>
19 </body>
20 </html>
page2.html

 

H5-页面跳转