I keep getting an unexpected token } error when trying to pass this.value as an argument.
In my body I have:
<input type="text" size="3" id="rbgTextbox" onkeypress="if (ValidateRGBTextboxInput(event)) ChangeBackgroundColor("+this.value+"); else return false;">
The functions:
<script type="text/javascript">
function ValidateRGBTextboxInput(e) {
return ById('rbgTextbox').value.length < 6 &&
(e.which >= 48 &&
e.which <= 57 ||
e.which >= 65 &&
e.which <= 70 ||
e.which >= 97 &&
e.which <= 102);
}
function ChangeBackgroundColor(color) {
alert(color);
ById('gameArea').style.backgroundColor = '#'+color;
ById('nextPiece').style.backgroundColor = '#'+color;
}
</script>
If I change ChangeBackgroundColor("+this.value+"); for ChangeBackgroundColor('000000'); I get no more error, but of course I need the pass the text input's value as the argument.