S1L3NC3
09-26-2003, 05:42 PM
Can anyone tell me why this script doesnt work? I wrote it up real fast, and its supposed to change the BG to the desired color when the corresponding button is clicked (obviously).
But instead of changing it, it simply flashes it and then returns to white.
<html>
<head>
<script language="javascript">
function backcolor(color)
{
document.bgColor=(color);
}
</script>
</head>
<body>
<div align="center">
<form name="buttons">
<input type="submit" value="White" name="elbutton" onClick="backcolor('white');">
<input type="submit" value="Green" name="elbutton" onClick="backcolor('green');">
<input type="submit" value="Red" name="elbutton" onClick="backcolor('red');">
<input type="submit" value="Blue" name="elbutton" onClick="backcolor('blue');">
<input type="submit" value="Black" name="elbutton" onClick="backcolor('black');">
<input type="submit" value="Purple" name="elbutton" onClick="backcolor('purple');">
</form>
</div>
</body>
</html>
But instead of changing it, it simply flashes it and then returns to white.
<html>
<head>
<script language="javascript">
function backcolor(color)
{
document.bgColor=(color);
}
</script>
</head>
<body>
<div align="center">
<form name="buttons">
<input type="submit" value="White" name="elbutton" onClick="backcolor('white');">
<input type="submit" value="Green" name="elbutton" onClick="backcolor('green');">
<input type="submit" value="Red" name="elbutton" onClick="backcolor('red');">
<input type="submit" value="Blue" name="elbutton" onClick="backcolor('blue');">
<input type="submit" value="Black" name="elbutton" onClick="backcolor('black');">
<input type="submit" value="Purple" name="elbutton" onClick="backcolor('purple');">
</form>
</div>
</body>
</html>