在一个FORM中实现多个ACTION动作

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>Untitled Document</title> 
<script language="JavaScript"> 
function act1() 

document.testForm.action="a.jsp"; 
document.testForm.submit();


function act2() 

document.testForm.action="b.jsp"; 
document.testForm.submit();


</script> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
</head>

<body> 
<form name="testForm" method="post" action=""> 
  <input name="Name" type="text" id="Name"> 
  <input type="button" name="Button" value="Act1" onClick="act1();"> 
  <input type="button" name="Submit2" value="Act2" onClick="act2();"> 
</form> 
</body> 
</html> 
---------------------------------------------------------------

<form name="frm1" action="javascript:void(0)" method="post"> 
a.jsp <input type="radio" name="rad" checked><br> 
b.jsp <input type="radio" name="rad"><br> 
<input type="button" name="btn" value="Submit" onClick="sub(frm1,'_self')"> 
</form>

<script language=javascript> 
function sub(form, target) 

if (form.rad[0].checked) { 
url = "/a.jsp"; 
form.action = url; 
form.target = target; 
form.submit(); 
} else if (form.rad[1].checked) { 
url = "/b.jsp"; 
form.action = url; 
form.target = target; 
form.submit(); 


</script>

原文地址:https://www.cnblogs.com/yujy/p/3025471.html