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

 

转载于:https://www.cnblogs.com/yoyoyoyoyoyo/p/5978023.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值