Flic
05-25-2006, 08:50 PM
I keep getting the above error and as far as I can see there is nothing wrong with the code, so its puzzling me somewhat. I'm getting the comment from the FireFox javascript console and for the line it says 0 so thats no use.
The javascript is:
function colourCheck(selected, other, colour){
if ( "Other colours" == selected[selected.selectedIndex].value ){
other.style.display = "";
}
other.style.display = "none";
}
I know the if statement works, but not what i want it to do rather annoyingly.
Its being called from:
<tr valign=top><td width=100>Item name:</td>
<td><input type="text" name="item1" size=50 onKeyPress="javascript:nextitem(item2, other1, colour1)"></td>
<td align=center><select name="colour1" onchange="colourCheck(this, 1)">
<option value="Jet and Black Diamond">Black / Grey</option>
<option value="Capri and Aquamarine">Blue / Light Blue</option>
<option value="Amethyst and Light Amethyst">Purple / Light Purple</option>
<option value="Light Siam and FireOpal">Red / Orange</option>
<option value="Garnet and Light Rose">Dark Red / Pink</option>
<option value="Other colours">Other colours</option></td>
<td><input type="text" name="other1" size=20 style="display:none"></td></tr>
I'm guessing this is where the problem is, as when I removed the style from the javascript it was still coming up, but I can't see what the problem is.
Any help much appreciated!
The javascript is:
function colourCheck(selected, other, colour){
if ( "Other colours" == selected[selected.selectedIndex].value ){
other.style.display = "";
}
other.style.display = "none";
}
I know the if statement works, but not what i want it to do rather annoyingly.
Its being called from:
<tr valign=top><td width=100>Item name:</td>
<td><input type="text" name="item1" size=50 onKeyPress="javascript:nextitem(item2, other1, colour1)"></td>
<td align=center><select name="colour1" onchange="colourCheck(this, 1)">
<option value="Jet and Black Diamond">Black / Grey</option>
<option value="Capri and Aquamarine">Blue / Light Blue</option>
<option value="Amethyst and Light Amethyst">Purple / Light Purple</option>
<option value="Light Siam and FireOpal">Red / Orange</option>
<option value="Garnet and Light Rose">Dark Red / Pink</option>
<option value="Other colours">Other colours</option></td>
<td><input type="text" name="other1" size=20 style="display:none"></td></tr>
I'm guessing this is where the problem is, as when I removed the style from the javascript it was still coming up, but I can't see what the problem is.
Any help much appreciated!