zoukankan      html  css  js  c++  java
  • JS---使用localStorage传递参数

    localStorage_send_page.html(发送页面)

    <!doctype html>
    <html>
    
        <head>
            <meta charset="UTF-8">
            <title></title>
            <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
            <link href="css/mui.min.css" rel="stylesheet" />
        </head>
    
        <body>
            <button type="button" class="mui-btn mui-btn-red">用localStorage向recieve_page页面传值</button>
            <script src="js/mui.min.js"></script>
            <script type="text/javascript">
                mui.init();
                //localStorage
                document.getElementsByTagName('button')[0].addEventListener('tap', function() {
                    localStorage.setItem('name', 'Harden');
                    window.location.href = 'localStorage_recieve_page.html';
                });
            </script>
        </body>
    
    </html>

    localStorage_recieve_page.html(接收页面)

    <!doctype html>
    <html>
    
        <head>
            <meta charset="UTF-8">
            <title></title>
            <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
            <link href="css/mui.min.css" rel="stylesheet" />
        </head>
    
        <body>
            <span id="span1">
                span1
            </span>
            <script src="js/mui.min.js"></script>
            <script type="text/javascript">
                mui.init();
                document.getElementById("span1").innerText='hi,'+localStorage.getItem('name');
            </script>
        </body>
    
    </html>
  • 相关阅读:
    springboot+fegin实现负载均衡
    springcloud实现微服务服务注册、负载均衡
    spring boot服务状态监控+shell远程连接服务
    微服务基础概念及相关技术组件
    集群分布式基础概念及了解
    http第一章-telnet测试
    spring整合netty

    springMVC+spring+JPA配置文件
    CAN信号值解析
  • 原文地址:https://www.cnblogs.com/beast-king/p/9113869.html
Copyright © 2011-2022 走看看