JavaScript ควบคุม action และ target ของ Form
JavaScript HTML Multiple Action Form
<html> <head> <title>ThaiCreate.Com Tutorials</title> </head> <body> <script language="JavaScript"> function fncAction1() { frmMain.action='webpage1.php' frmMain.target='iframe_target'; frmMain.submit(); } function fncAction2() { frmMain.action='webpage2.php' frmMain.target='iframe_target'; frmMain.submit(); } function fncAction3() { frmMain.action='webpage3.php' frmMain.target='iframe_target'; frmMain.submit(); } </script> <form name="frmMain" method="post"> <iframe id="iframe_target" name="iframe_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe> First Name : <input type="text" name="txtFirstName"><br> Last Name : <input type="text" name="txtLastName"><br> <input name="btnButton1" type="button" value="Action 1" OnClick="fncAction1()"> <input name="btnButton2" type="button" value="Action 2" OnClick="fncAction2()"> <input name="btnButton3" type="button" value="Action 3" OnClick="fncAction3()"> </form> </body> </html>