background color change problem

Lief Webster's Avatar, Join Date: Oct 2007
Go4Expert Member
This is my first time using JavaScript, and I found a tutorial online to learn off of. Here is the code I have made, meant to make three buttons, each of which change the background color of the window.

Code:
<html>
<head>

<SCRIPT LANGUAGE="JavaScript">

function BgColor (color) {
document.bgColor=color }

</SCRIPT>
</head>

<body>
<form>
<input type="button" name="redbutton" value="Red" onClick="changecolor ('red')">

<input type="button" name="bluebutton" value="Blue" onClick="changecolor ('blue')">

<input type="button" name="greenbutton" value="Green" onClick="changecolor ('green')">
</form>

</body>
</html>
The problem is, whenever you hit a button, nothing at all happens. Any help, please?
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Just look at your silly mistake dude, check the name of the defined function and the one you are calling!!