JavaScript pop up close on submit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Billy Purdy
    New Member
    • Jul 2011
    • 1

    JavaScript pop up close on submit

    We had a developed add a pop up on our site, and I am trying to get it to close once submit is pressed... I have searched around and tried many things but nothing seems to work. I am not too familiar with JavaScript was wondering if anyone has any suggestions...

    below is the main part of the code.

    Much appreciated!


    Code:
        <form action="/inc/usda-hardiness-zones.htm" method="post">
          <input name="hitit" type="hidden" value="1" />
          <tr>
            <td colspan="4" align="right"><a href="javascript:MM_showHideLayers('usdazone','','hide');" onclick="document.getElementById('usdazone').style.zIndex = '-1';" class="clickclose">Click Here to Close</a><br /><br /></td>
    
    ... blah blah blah ...
    
    <input name="zipcode" type="text" value="<? if( isset( $zip ) ) { echo $zip; } ?>" size="5" maxlength="5" class="usdainput" />
              &nbsp;&nbsp;
              <input type="submit" value=" Get My USDA Zone! " onclick="javascript:submitForm(); javascript:self.close(); return false;" class="clickclose" />
    Last edited by Dormilich; Jul 11 '11, 07:20 PM. Reason: please use [CODE] [/CODE] tags when posting code
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Once the form is submitted, the next statement won't run. What you'll have to do is close it once the new page has loaded - use the onload event.

    Comment

    Working...