I have the following script that I cant quite make work…. you are supposed to be able to choose a color from the drop down menu, click the button and the background should become the chosen color until a new color is chosen, or the page refreashed.
[Code]
<html>
<head>
<title>Color Changer</title>
<Link href=”externalcolorselect.css” rel=”Stylesheet” type=”Text/CSS”>
<script type=”javascript”>
Function getColor(){
var theSelect=document.myForm.color;
var theOption=theSelect.options[theSelect.selectedIndex];
var theColor=theOption.value;
document.body.style.backgroundColor=theColor;
}
</script>
</head>
<body>
<h1>Background Color Changer:</h1>
<h3>Please Select a Color</h3>
<center>
<form name=”myForm”>
<select name=”color”>
<option value=”red”>Red</option>
<option value=”blue”>Blue</option>
<option value=”green”>Green</option>
<option value=”yellow”>Yellow</option>
<option value=”white”>White</option>
document.myForm.color.selectedindex
</select>
</form>
<input type=”button” onclick=”getColor()” value=”Change Background Color” />
</center>
<hr>
<br />
</body>