I’m trying to make a dynamic menu using javascript but I keep getting an error message saying that document.myform has no properties. I can’t see any problems myself. I’m not very good with javascript. Here is my code, could you please look at it and tell me if you see a problem?
Thanks
<html>
<head>
<script>
function changemenu()
{
for ( i=1; i<Rock.length; i++)
{
document.myform.myselect.options[i] = menu[i];
}
for ( i=2; i<Metal.length; i++)
{
document.myform.myselect.options[i] = menu[i];
}
for ( i= 3; i<Indie.length; i++)
{
document.myform.myselect.options[i] = menu[i];
}
}
document.myform.myselect.options[1] = new Option (“Rock”, “1”);document.myform.myselect.options[2] = new Option (“Metal”, “2”);
document.myform.myselect.options[3] = new Option (“Indie”, “3”);
var Metal = new Array();
Metal [1] = new Option (“Metallica”, “artist1”);
Metal [2] = new Option (“SystemOfADown”, “artist2”);
var Indie = new Array();
Indie [1] = new Option (“DamienRice”, “artist1”);
Indie [2] = new Option (“SnowPatrol”, “artist2”);
var Rock = new Array();
Rock [1] = new Option (“Incubus”, “artist1”);
Rock [2] = new Option (“Pearl Jam”, “artist2”);
</script>
</head>
<body>
<form name = “myform”>
<table cellpadding=10>
<tr>
<td><p><select name=”myselect”>
<option selected>genre </option>
<option> Rock </option>
<option> Metal </option>
<option> Indie </option>
</select>
</p>
</td>
<td>
<p><select>
<option selected>artist</select>
<option value = “artist1” > </option>
<option value = “artist2” > </option>
</select>
</p>
</td>
<td>
<p><select>
<option selected>Album</select>
<option value = “album1”></option>
<option value=”album2″></option>
<option value=”album3″></option>
</select>
</p>
</td>
</tr>
</table>
</form>
</body>
</html>