Archive for the ‘JavaScript’ Category

Change form action value by JavaScript

Friday, April 9th, 2010

We come across various time that we need to change the form action according to the Event

Let me provide a simple JavaScript Example which will help you

<script type=”text/javascript”>
function changeAction(url){
alert(url);
document.this_form.action = url;
}</script>
HTML
<form method=”POST” name=”this_form” action=”http://www.minervait.com”>
<input type=”radio”  name=”PromotionPackets”  value=”http://www.minervait.com”  onClick=”changeAction(this.value);”>Minervait.com
<input type=”radio” name=”PromotionPackets”  value=”http://www.minervainfocom.com”  onClick=”changeAction(this.value);”>Minervainfocom.com
</form>

Please find its  EXAMPLE

Minervait.com

Minervainfocom.com

We will keep posting more such handy function.

Minerva Infotech is Leading Best PHP & JavaScript Programming company