Mega Code Archive

 
Categories / JavaScript DHTML / HTML
 

View and change the action URL of a form

<html> <head> <script type="text/javascript">     function getAction(){         var x=document.forms.myForm         alert(x.action)     }     function changeAction(){         var x=document.forms.myForm         x.action="default.asp"         alert(x.action)     } </script> </head> <body> <form name="myForm" action="js_examples.asp"> <input type="button" onclick="getAction()" value="View value of action attribute"> <br> <input type="button" onclick="changeAction()" value="Change value of action attribute"> </form> </body> </html>