now I want that the value of form action="" will varry according to the variable p1.
then <form name="form1" method="post" action="1.php">
How many options will p1 equal? Just one or a whole bunch like 1-10?
....elements, at least one of which changes or determines p1...
<input type='button' value='submit' onClick="sendIt(this.form)">
var ok2Send = true;
...code to validate or whatever
... if(somefield validation fails) ok2Send = false;
case 1: // means p1 == 1
formObj.action = 'somepage.asp'
case 2: // means p1 == 2
formObj.action = 'somepage2.asp'
above will work if p1 is a global var, else you need to pass p1 to the function. If you have only 2 actions use an if/else instead of the switch