VS2010を使用してphonegapの小さな例を記述していますが、window.locaStorageを使用して単純な値を格納および取得できない理由がわかりません。
確認して、何が問題なのか教えてください
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Cordova WP7</title>
<link rel="stylesheet" href="jquery.mobile-1.1.0.css" type="text/css"/>
<script src="jquery-1.7.2.js" type="text/javascript"></script>
<script src="jquery.mobile-1.1.0.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready",onDeviceReady,false);
// once the device ready event fires, you can safely do your thing! -jm
function onDeviceReady()
{
//document.getElementById("welcomeMsg").innerHTML += "Cordova is ready! version=" + window.device.cordova;
console.log("onDeviceReady. You should see this message in Visual Studio's output window.");
//navigator.notification.alert("Hello World");
};
$(function(){
$("#savebtn").click(function(){
window.localStorage.setItem("modelname", $("#modelname").val());
});
$("#androidpg").live("pageshow", function () {
var moname = ""
moname = window.localStorage.getItem("modelname");
if (moname.length > 0) {
$("#modelname").val(moname);
}
});
});
</script>
</head>
<body>
<div data-role="page" id="home">
<div data-role="header">
<h1>Home</h1>
</div>
<div data-role="content">
This Demo can run on:
<ul>
<li>iOS</li>
<li>Android</li>
<li>BlackBerry</li>
<li>Windows Mobile</li>
</ul>
<a href="#androidpg" data-role="button">Goto Android Page</a>
</div>
<div data-role="footer" data-position="fixed">
<h4>All Rights Reserved</h4>
</div>
</div>
<div data-role="page" id="androidpg">
<div data-role="header">
<h1>Android</h1>
</div>
<div data-role="content">
<h1>Android Page</h1>
<label for="modelname">Enter Model Name:</label>
<input type="text" name="modelname" id="modelname" value="" />
<a href="#savebtn" data-role="button">Save</a>
</div>
<div data-role="footer" data-position="fixed">
<h4>All Rights Reserved</h4>
</div>
</div>
</body>
</html>
ありがとう