关于本地存储localStorage
来源:互联网 发布:淘宝分享有礼有用吗 编辑:程序博客网 时间:2024/06/07 00:23
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body> <div style="border: 2px dashed #ccc;width:320px;text-align:center;"> <label for="sitename">网站名(key):</label> <input type="text" id="sitename" name="sitename" class="text"/> <br/> <label for="siteurl">网 址(value):</label> <input type="text" id="siteurl" name="siteurl"/> <br/> <input type="button" onclick="save()" value="新增记录"/> <hr/> <label for="search_phone">输入网站名:</label> <input type="text" id="search_site" name="search_site"/> <input type="button" onclick="find()" value="查找网站"/> <p id="find_result"><br/></p> </div> <script type="text/javascript"> function save(){ if(window.localStorage){ var sitename=document.getElementById("sitename").value; var siteurl=document.getElementById("siteurl").value; localStorage.setItem(sitename,siteurl); alert("添加数据成功!"); }else{ alert("no support storage!"); } } function find(){ var search_site=document.getElementById("search_site").value; var sitename=localStorage.getItem(search_site); var find_result=document.getElementById("find_result"); find_result.innerHTML=search_site+"的网址是:"+sitename; } </script></body></html>
阅读全文
0 0
- 关于本地存储localStorage
- 关于本地存储localStorage
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- localStorage用于本地存储
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- 本地存储localstorage
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- 本地存储—localStorage
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- HTML5 LocalStorage 本地存储
- Heartbeat
- get方式获取页码,id号分页显示查询结果
- HDU 2017 多校联合训练赛1 1002 6034 Balala Power 排序
- javascript时间戳和日期字符串相互转换
- HDU6038-Function(置换群)
- 关于本地存储localStorage
- Android Clipboard(复制/剪贴板)
- 【Java笔记】TreeSet的自然顺序和制定顺序
- Android studio使用JNI实例
- ZooKeeper之Java API
- rhel6.5集群管理
- WPF Socket客户端(重连)
- 常用Scikit-learn特征选择方法
- yii 框架转换json返回时间为Y-m-d H:i:s