实例如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Database Example</title> <script type="text/javascript" charset="UTF-8" src="cordova.js"></script> <script type="text/javascript" charset="UTF-8"> document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { } function storeName(){ var myName=document.getElementById("name").value; window.localStorage.setItem("name",myName);//存储 var result=document.getElementById("result"); result.innerHTML="Your name is"+window.localStorage.getItem("name");//取出存储值 return false; } </script> </head> <body> <form> <p>What is your name?<br /> <input type='text' id='name' onkeyup='storeName()'></p>//键盘弹起 <input type='text' id='name' onblur='storeName()'></p>//焦点移到输入框外 </form> <p id='result'>show content</p> </body> </html>
以上就是phonegap实现进行本地存储的方法介绍的详细内容,更多请关注二当家的素材网其它相关文章!
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群