I pulled this code out of the book I'm learning JavaScript from. Problem is that it doesn't work in my browser. I'm using IE 5.5. I wrote the code, saved it as a html file, opened it , and....nothing!
Can someone please check my code
<html>
<head>
<title>Controlling Styles with JavaScript</title>
<script language="Javascript">
function changehead() {
i = document.form1.heading.selectedIndex;
headcolor = document.form1.heading.options[i].value;
document.getElementById("head1").style.color = headcolor;
}
function changebody() {
i = document.form1.body.selectedIndex;
doccolor = document.form1.body.options[i].value;
document.getElementById("p1").style.color = doccolor;
}
</script>
</head>
<body>
<h1 ID="head1">Controlling Styles with JavaScript</h1>
<hr />
<p ID="p1">
Select the color for paragraphs and heading using the form below.
The colors ;you specified will be dynamically changed in this document.
The change occurs as soon as you change the value of either of the
drop-down lists in the form.
</p>
<FORM NAME="form1">
<B>Heading Color: </B>
<select name="heading" onChange="changehead();">
<option value="black">Black</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option value="yellow">Yellow</option>
</select>
<br />
<B>Body Text Color: </B>
<select name="Body" onChange="changebody();">
<option value="black">Black</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option value="yellow">Yellow</option>
</select>
</FORM>
</body>
</html>
responses appreaciated in advance