• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2865
  • Last Modified:

onClick submit for a form not working in Firefox

I know forms of this has been asked tons of times, but I can't seem to make out the fix.  can someone tell me the correction I need to make to my code so that this form will submit in Firefox?  Works fine in IE.  Thsi is a form that uses an image for the submit button.  The form works fine in IE, and it works if you hit "ENTER" in Firefox, but the image button will not fire the submit action....please help.  here is the code...
<table border="0" cellspacing="0" cellpadding="4">
<form name="sform" method="post" action="_search.php">
<td align="center">
<NOBR><span style="font-weight: bold; font-family: Arial, Helvetica, sans-serif">ZIP CODE SEARCH</span></NOBR>
<td><input name="zipcode" type="text" size="20"></td>	
<td><img border="0" src="images/go.gif" width="30" height="25" style="cursor:pointer" onClick="submit(this.form);">

Open in new window

  • 2
1 Solution
Hi hbogie.

This solution deals with this problem you're having:

Just to surmise:

Courtesy of zvonko

"onClick="javascript:document.forms[0].submit();return false"

Alternatively, to specify by form name:

Three syntax methods:

onClick="javascript:document.forms['yourFormName'].submit();return false"


onClick="javascript:document.forms.yourFormName.submit();return false"


onClick="javascript:document.yourFormName.submit();return false"
hbogieAuthor Commented:
THANKS...have been looking all afternoon and got so many variations....your quick answer worked perfectly!

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now