Filed Under (Javascript Code Samples) by Anoop on May-11-2007

//Function to Change the action of a form in Javascript

Code (javascript)


<script type="text/javascript">
function changeAction()
{
        document.getElementById("myForm").action = 'http://techjunk.websewak.com';
}
</script>
Example usage:
<form id="myForm" action="http://www.yah.in">
<input type="button" onclick="changeAction()" value="Change value of action attribute">
<input type='submit' value='Submit'>
</form>
 


Post a comment
Name: 
Email: 
URL: 
Comments: