72
rated 0 times
[
74]
[
2]
/ answers: 1 / hits: 22003
/ 12 Years ago, sun, july 15, 2012, 12:00:00
I just started to study Phonegap + jQuery Mobile and HTML5,, so don't loose your nerve with my idiocy!
Could somebody tell me why this is not working? When I am using a variable from localStorage, I just get an empty screen when pressing the button, but when using a variable temperature=100, it is working fine. Android 4.1.
<script type=text/javascript charset=utf-8>
document.addEventListener(deviceready, onDeviceReady, false);
function onDeviceReady() {
window.localStorage.setItem(temperature, 100);
var temperature = window.localStorage.getItem(temperature);
}
</script>
<div data-role=content>
<p>Working or not?</p>
<button onclick=myFunction()>Try it</button>
<p id=testi></p>
<script type=text/javascript>
function myFunction() {
//var temperature = 100;----> This is working!
document.getElementById(testi).innerHTML = temperature;
}
</script>
</div>
Another question: How to handle variables between pages in Windows Phone? They are not supporting localStorage, so is there another way to handle this if you haven't got db-connection?
Thanks!
Sami
More From » android