应用phonegap开展当地储存的完成方式

2021-02-24 01:44 jianzhan

案例以下:

 

<!DOCTYPE html> 
<html> 
  
    <head> 
        <meta charset="UTF⑻"> 
        <title>Database Example</title> 
  
        <script type="text/javascript" charset="UTF⑻" src="cordova.js"></script> 
        <script type="text/javascript" charset="UTF⑻"> 
            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> 
        <div id='result'>show content</div> 
    </body> 
  
</html>

以上这篇应用phonegap开展当地储存的完成方式便是网编共享给大伙儿的所有內容了,期待能给大伙儿1个参照,也期待大伙儿多多适用脚本制作之家。