<html>
<head>
<title>Color Chooser</title>
<script>
function changeColor(){
var theSelect = document.myForm.selColor;
var selectedOne = theSelect[theSelect.selectedIndex];
var theColor = selectedOne.value;
document.bgColor = theColor;
}</script>
</head>
<body>
Color Chooser
<form name = "myForm">
<select name = selColor>
<option value = red>red</option>
<option value = green>green</option>
<option value = blue>blue</option>
</select>
<br>
<input type = "button"
value = "change color"
onClick = "changeColor()">
</form>
</body>
</html>
|