|
Loading...
|
iphonewebdev@googlegroups.com
[Prev] Thread [Next] | [Prev] Date [Next]
Re: using toggle to save login with local storage Mogens Beltoft Thu Feb 09 11:00:39 2012
Hi, What toggle are you referring to? If it's a checkbox, then have a look at this page: http://www.javascriptkit.com/jsref/checkbox.shtmlIf you use the onclick event you need to find the state of your toggling object to determine whether to call add() or remove().
/Mogens On 27-01-2012 12:36, saroy wrote:
hi all
i would like to use toggle to save login with local storage (toggle
off = onclick save to local storage, toggle on = onclick remove
localstorage)
i used to function for this :
for add :
function add() {
window.localStorage.setItem("compte",
document.getElementById('txtNum_Compte').value);
window.localStorage.setItem("acces",
document.getElementById('txtCode_Accer').value);
}
for remove :
function remove() {
window.localStorage.removeItem("compte");
window.localStorage.removeItem("acces");
}
and this function on body load page to get localstorage
function getcompte() {
if (localStorage.getItem("txtNum_Compte") != "")
{ document.getElementById('txtNum_Compte').value =
window.localStorage.getItem("compte");
document.getElementById('txtCode_Accer').value =
window.localStorage.getItem("acces");
}
how can i attribute this function to onclick toogle to get run
and how can save toogle state
thanks in advance and sorry for my bad english
-- You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group. To post to this group, send email to [EMAIL PROTECTED] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
- using toggle to save login with local storage saroy 2012/02/09
- Re: using toggle to save login with local storage Remi Grumeau 2012/02/09
- Re: using toggle to save login with local storage Mogens Beltoft 2012/02/09 <=
- Re: using toggle to save login with local storage Mogens Beltoft 2012/02/09