javascript - Navigation within a phonegap application -
i playing around local storage on phonegap, trying create javascript login. current problem when run application, not go main menu if username , password correct.
i believe problem window.location.href
method. want navigate local page, not online one.
van suggest way this?
$(document).ready(function() { if (typeof(localstorage) === 'undefined' ) { alert('your browser not support html5 localstorage. try upgrading.'); } else { $("#return_form2").submit(function(){//load items getitems(); }); } }); var getitems = function() { var timelog, loglength, i; = 0; loglength = localstorage.length-1; //how many items in database starting 0 timelog = ''; // loop through each item in database (i = 0; <= loglength; i++) { var itemkey, value, values, firstname, password, email; //variables key , values itemkey = localstorage.key(i); value = localstorage.getitem(itemkey); values = json.parse(value); firstname = values.fname; password = values.pass; email = values.email; course = values.class; var tt = course; var un = document.return_form2.username.value; var pw = document.return_form2.password.value; var web = "web systems development"; if ((un == firstname) && (pw == password) && (tt == web)){ window.location.href = "appmenu.html"; return false; } else { alert ("incorrect password"); } }}
i'm not sure ((un == firstname) && (pw == password) && (tt == web))
true
, anyway, next line worked me
window.location="appmenu.html";
also don't have return false
Comments
Post a Comment