Hi. I have some Javascript that works fine in IE and Netscape 4.7, but gives the following error in Netscape 6 (on the lines indicated with a *): Error: object is not a function. THis occurs on the 2 lines below marked with a * (depending on whether you hit "Compare" or "compare all". Below is the code:
<SCRIPT LANGUAGE="JavaScript1.1">
<!-- //Hide from old browsers
function compareSelected()
{
if (isChecked())
{
document.competitors.submit();
}
else
{
alert("Please select a model.");
}
}
function compareAll()
{
for (var i=0; i< document.competitors.elements.length; i++)
{
if (document.competitors.elements[i].type == 'checkbox')
{
document.competitors.elements[i].checked = true;
}
}
document.competitors.submit();
}
function isChecked()
{
var checked=false;
for (var i=0; i< document.competitors.elements.length; i++)
{
if (document.competitors.elements[i].type == 'checkbox')
{
if (eval("document.competitors.elements[i].checked") == true)
{
checked = true;
}
}
... more unrelated
java script...
</script>
...
<form name="competitors" method="post" action="my
servlet name">
... rest of form check boxes etc. ...
<td valign="top" colspan="2" align="center"><a href="javascript:compareSelected()"><img src="/compareselected150x22.gif" width="150" height="22" alt="Compare Selected" border="0" /></a>
<br />
<a href="javascript:compareAll()"><img src="/compareall131x22.gif" width="131" height="22" alt="Compare All" border="0" /></a></td>
</tr>
</form>