zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    [CF666E] Forensic Examination
    [BZOJ3739] DZY loves math VIII
    [BZOJ3561] DZY Loves Math VI
    VS中的类模板
    php中的this,self,parent
    js中的 Table 对象
    CEF中弹出窗口的处理
    VC禁止或允许拖拽改变窗口尺寸
    MFC系统自动生成的停靠窗格关掉后,如何重新显示?
    VS2010 如何自动生成UML图
  • 原文地址:https://www.cnblogs.com/yoyoyoyoyoyo/p/5978023.html
Copyright © 2011-2022 走看看