javascript - onclick method doesn't work in Chrome -
this code works in mozilla firefox, not in chrome.
<html> <head> <script language="javascript"> <!-- function onbutton1() { document.form1.action = "response1.php" document.form1.target = "_blank"; // open in new window document.form1.submit(); // submit page return true; } function onbutton2() { document.form1.action = "response2.php" document.form1.target = "_blank"; // open in new window document.form1.submit(); // submit page return true; } --> </script> <noscript>you need javascript enabled work</noscript> </head> <body> <form name="form1" method="post"> name <input type="text" name="name" size="10" /><br /> <input type="button" value="button1" name=name onclick="onbutton2();onbutton1();"> </form> </body> </html>
what can use in place of onclick
trigger 2 actions?
thanks @dfsq providing answer !
it's possible in chrome if add little timeout in second submission
<html> <head> <script language="javascript"> <!-- function onbutton1() { document.form1.action = "response1.php" document.form1.target = "_blank"; document.form1.submit(); } function onbutton2() { document.form1.action = "response2.php" document.form1.target = "_blank"; document.form1.submit(); } --> </script> </head> <body> <noscript>you need javascript enabled work</noscript> <form name="form1" method="post"> name <input type="text" name="name" size="10" /> <br /> <input type="button" value="button1" name="name" onclick="onbutton1();settimeout(onbutton2, 50)"> </form> </body> </html>
Comments
Post a Comment