zoukankan      html  css  js  c++  java
  • html5_storage存取实例

    <script src="jquery-1.8.3.js"></script>
    <script>
    function set()
    {
        var tt=$("#text").val();
        //sessionStorage.setItem("tt",tt); //赋值存入缓存此方法浏览器重启就会清空
        localStorage.setItem("tt",tt);//赋值存入本地文件此方法浏览器重启还会存在
    }
    function get()
    {
        //alert(sessionStorage.getItem('tt'));//获取sessionStorage存放内容
        alert(localStorage.getItem("tt"));//获取localStorage存放内容
        localStorage.removeItem("tt");//删除localStorage数据
        localStorage.clear();//清楚localStorage所有数据

    }
    </script>
    <body>
    <input type="text" id="text">
    <input type="button" onClick="set()" value="确认">
    <input type="button" onClick="get()" value="获取">

  • 相关阅读:
    MathML
    Redux counterpart rematch dva
    flow
    pauseable 库
    a simple machine learning system demo, for ML study.
    react图工具集成
    SQLite
    Celery
    RabbitMQ installation
    Thunk
  • 原文地址:https://www.cnblogs.com/bk7788/p/6680096.html
Copyright © 2011-2022 走看看