views:

18

answers:

1

hello, I'm trying to use localStorage to register the right answers to an offline game. I've got the key and value stored, and can alter it using the bode below. I'd like each right answer to add to the localStorage.right plus 1 then move to the new page. Any ideas? Thank you in advance

A: 

Should work

localStorage.right = localStorage.right++;

Or a bit nicer:

// 'right' is a bit conflict prone.
localStorage.correctAwnsers = localStorage.correctAwnsers + 1;

Note: localStorage is only supported in the latest browsers.
Note: When testing from file:// protocol, localStorage goes wonky in some browsers.

BGerrissen