Tuesday, June 2, 2009

How To Change Form Action at Runtime

How to change Form action at runtime using javascript. This the example which will change html form action at runtime.

CODE:
1 :  <html>
2 :  <head>
3 :  <Script Language="javascript">
4 :  function change_action(){
5 :  var frm_obj=document.getElementById("frm");
6 :  frm_obj.action="http://www.google.com";
7 :  }
8 :  </Script>
9 :  </head>
10 :  <body>
11 :  <form id="frm" action="abc.php" method="post" onsubmit="return change_action()">
12 :  UID &nbsp;&nbsp;<input type="text"><br>
13 :  PWD <input type="Password"><br><br>
14 :  <input type="submit" value="submit">
15 :  </form>
16 :  </body>
17 :  </html>

2 comments:

  1. Hi Sir,

    Please tell me how i convert the html to PDF on run time in PHP.

    Rakesh

    ReplyDelete