I am having trouble. I am looking to press a button and have a random number return into a text box. If the number is even I want to change the background color to Red, and if its odd I want to change the background color to black. I have it almost working,but it does not continue to change the background color when I keep pressing the button, it only does the first. Here is my code. Any help would be appreciated.
<script type="text/javascript">
function BackgroundEven(){
document.body.style.backgroundColor="#DA0505";
}
function BackgroundOdd(){
document.body.style.backgroundColor="#000000";
}
function Random() {
return Math.floor(Math.random()*37);
}
var rando= Random();
function Change(){
if(rando%2 == 0)
{
BackgroundEven();
}
else{
BackgroundOdd();
}
}
}
</script>
<input type="text" name="Result" value="" id="Random" size="5"/>
<input type="button" value="Spin" onclick="document.getElementById('Random').value=Random();Change();" />
</input>