• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why doesn't this work in Netscape 6?

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Katie McCann
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops- I forgot to put the "*" next to the lines that are causing the error. SEe below:
<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>
 
rubbery bacon. crispy tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic