Makes sense. Except that from his load_game() function, it would appear that player_turn
is a <select> and not a group of radio buttons. (Notice the selecteIndex
If that's the case, then no loop is needed:
localStorage.current_player = document.player_turn_form.player_turn.selectedIndex;
And then this should be right, too:
var form = document.player_turn_form; // BAD BAD! Named forms are obsolete!!
form.player_turn.selectedIndex = localStorage.getItem("current_player");
Ehhh...he seems really really badly confused. On the one hand it looks like a set of radio buttons (.checked
) but on the other hand it looks like a <select> (selectedIndex
And then he is using a named <form> which is verboten in HTML5.
And and and...
I think he is trying to run before he has learned how to crawl. Looks like he has problems in his <form> and in his understanding of how to manipulate <form> elements, so he's really not ready for local storage.