<html>
<form>
<input type="button"
value="Yellow"
name="Yellow"
onClick="changeBG('yellow')">
<input type="button"
value="Green"
name="Green"
onClick="changeBG('green')">
<input type="text"
name="color">
</form>
<script language="JavaScript">
<!--
function changeBG(color)
{
document.bgColor=color; //Change background color
document.myForm.color.value=color; //Display the color
}
-->
</script>
</html>
|