there are a couple of minor problems with your code there, problems that will stop it executing the way you expect it to.
PHP Code:
...
if (this.value = 0); //here
this.value = 1;
player.chat = "On!";
}
else {
...
Firstly, after an if should be a { not a ;.
Secondly, comparision is done with == not =.
= is used to set values and can be read as "becomes". == can be read as "is equal to", so that line of code should be this:
PHP Code:
if (this.value == 0) {