javascript submit 2 forms not working in chrome -
i have 2 forms submitted on 1 submit click, download 2 files.
this downloading 2 files in firefox, downloads 1 file in chrome.
i have edited , inserted full code per request.
full code:
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>export invoice </title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <script language="javascript"> function runscript() { document.f1.submit(); document.f2.submit(); } </script> </head> <body> <form name="f1" method="post" action="export-tst-with-header.php" target="_blank"> <table width="810" height="140" border="0" cellpadding="5" cellspacing="0" class="uniq" align="center"> <tr class="uniq"> <td width="363" valign="middle"> <br> <span class="sty2">enter export invoice no.:</span> <input type="text" size='10' maxlength='10' name="finv" onblur="showfrom(this.value);"> <span class="sty2">to invoice no:</span> <input type="text" size='10' maxlength='10' name="tinv" onblur="showto(this.value);"> </td> </tr> <tr class="uniq"> <td width="363" valign="top"><div align="center"><br> <br> </form> <form name="f2" method="post" action="export-tst-with-header2.php" target="_blank"> </form> <input type="button" value="export" onclick="runscript();" /> <a href='index.htm' target='_parent'><input name="close" type="button" value="close !"></a> </div></td> </tr> </table> <br> </body> </html>
edit: here test ran, cleaned lot of issues in html , js. found solution will, in fact, hit both urls in chrome.
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>export invoice </title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> function runscript() { document.forms.f1.submit(); window.settimeout(function() { document.forms.f2.submit(); }, 500); } </script> </head> <body> <table width="810" height="140" border="0" cellpadding="5" cellspacing="0" class="uniq" align="center"> <tr class="uniq"> <td width="363" valign="middle"> <form name="f1" method="post" action="export-tst-with-header.php" target="_blank"> <br /> <span class="sty2">enter export invoice no.:</span> <input type="text" size='10' maxlength='10' name="finv" onblur="showfrom(this.value);" /> <span class="sty2">to invoice no:</span> <input type="text" size='10' maxlength='10' name="tinv" onblur="showto(this.value);" /> </form> </td> </tr> <tr class="uniq"> <td width="363" valign="top"> <div align="center"> <br /> <br /> <form name="f2" method="post" action="export-tst-with-header2.php" target="_blank"> </form> <input type="button" value="export" onclick="runscript();" /> <a href='index.htm' target='_parent'><input name="close" type="button" value="close !"></a> </div> </td> </tr> </table> <br /> </body> </html>
Comments
Post a Comment