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
  • 相关阅读:
    小程序首页不显示tabbar
    小程序之背景音乐——wx.backgroundAudioManager
    根据浏览器分辨率自动调整网页宽度的一个例子
    vue 限制input[type=number]的输入位数策略整理
    php刷新当前页面
    PHP中获取当前页面的完整URL
    如何使用php session
    常用网页播放器代码
    php session 生命周期代码实例
    去掉删除discuz x3.2 的-Powered by Discuz!
  • 原文地址:https://www.cnblogs.com/yoyoyoyoyoyo/p/5978023.html
Copyright © 2011-2022 走看看