why my array is losing it's contents when I refresh the page?

Posted by Fernando SBS on Stack Overflow See other posts from Stack Overflow or by Fernando SBS
Published on 2010-05-09T23:18:50Z Indexed on 2010/05/09 23:28 UTC
Read the original article Hit count: 206

Filed under:
|
|
|

I have created an:

var checkboxFarm = new Array();

then I want to record a checkbox status in that array, as there are 11 checkboxes.

Button.addEventListener("click", function() {

          rp_farmAtivada(index);

        }, false);

when clicked change the variable in the array:

function rp_farmAtivada(index) {
     checkboxFarm[index] = !checkboxFarm[index];
};

but every time I refresh the page it loses all the checkboxes status and I'm aware that all that array gets the "undefined" value.

the checkboxFarm array is defined in the beginning of the script, so it should have a global scope.

Am I missing something?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about array