onClick submit for a form not working in Firefox

Posted on 2008-11-16
Last Modified: 2013-12-07
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

Question by:hbogie
    LVL 7

    Expert Comment

    Hi hbogie.

    This solution deals with this problem you're having:
    LVL 7

    Accepted Solution

    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"

    Author Closing Comment

    THANKS...have been looking all afternoon and got so many variations....your quick answer worked perfectly!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Several part series to implement Internet Explorer 11 Enterprise Mode
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
    How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now