国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開(kāi)通VIP
HTML5 Web存儲(chǔ)的localStorage和sessionStorage的使用方法【圖文說(shuō)明】
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title></title>    <style type="text/css">        textarea {            width: 300px;            height: 300px;        }        .button {            width: 100px;        }    </style></head><body onload="init()">    <script type="text/javascript">        //使用HTML5 Web存儲(chǔ)的localStorage和sessionStorage方式進(jìn)行Web頁(yè)面數(shù)據(jù)本地存儲(chǔ)。        //頁(yè)面參考如下圖,能將頁(yè)面上的數(shù)據(jù)進(jìn)行本地存儲(chǔ)。并能讀取存儲(chǔ)的數(shù)據(jù)顯示在頁(yè)面上。        var t1;        var t2;        var oStorage;        var oStorage;        function init() {//初始化t1,t2            t1 = document.getElementById("t1");            t2 = document.getElementById("t2");            sStorage = window.sessionStorage;            lStorage = window.localStorage        }        function saveSession() {            sStorage.mydata = t2.value;            t1.value += "sessionStorage保存mydata:" + t2.value + "\n";        }        function readSession() {            t1.value += "sessionStorage讀取mydata:" + sStorage.mydata + "\n";        }        function cleanSession() {            t1.value += "sessionStorage清除mydata:" + sStorage.mydata + "\n";            sStorage.removeItem("mydata");        }        function saveStorage() {            lStorage.mydata = t2.value;            t1.value += "localStorage保存mydata:" + t2.value + "\n";        }        function readStorage() {            t1.value += "localStorage讀取mydata:" + lStorage.mydata + "\n";        }        function cleanStorage() {            t1.value += "localStorage清除mydata:" + lStorage.mydata + "\n";            lStorage.removeItem("mydata");        }    </script>    <div>        <textarea id="t1"></textarea><br />        <label>需要保存的數(shù)據(jù): </label>        <input type="text" id="t2" /><br />        <input type="button" class="button" onclick="saveSession()" name="b1" value="session保存" />        <input type="button" class="button" onclick="readSession()" value="session讀取" />        <input type="button" class="button" onclick="cleanSession()" value="session清除" /><br />        <input type="button" class="button" onclick="saveStorage()" value="local保存" />        <input type="button" class="button" onclick="readStorage()" value="local讀取" />        <input type="button" class="button" onclick="cleanStorage()" value="local清除" />    </div></body></html>
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
[html] 第103天 請(qǐng)描述一下cookies、sessionStorage和localStorage的區(qū)別?
JS的本地保存localStorage、sessionStorage用法總結(jié)
html5本地存儲(chǔ)之localstorage 、本地?cái)?shù)據(jù)庫(kù)、sessionStorage簡(jiǎn)單使用示例
html5指南
HTMl5的sessionStorage和localStorage
留言板源代碼
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服