HTML是不允许FORM嵌套的,用一个简单的JAVASCRIPT就可以解决问题了 :
<script language=javascript>
function process(v){
if(v=="in"){
document.theForm.action="in.jsp";
}else{
document.theForm.action="out.jsp";
}
document.theForm.submit();
}
</script>
<form name=theForm method=post>
<input type=text name=username>
<input type=text name=password>
<input type=button name=login value=LOGIN
<input type=button name=logout value=LOGOUT
<form>
<script language=javascript>
function process(v){
if(v=="in"){
document.theForm.action="in.jsp";
}else{
document.theForm.action="out.jsp";
}
document.theForm.submit();
}
</script>
<form name=theForm method=post>
<input type=text name=username>
<input type=text name=password>
<input type=button name=login value=LOGIN
<input type=button name=logout value=LOGOUT
<form>
还可以参考下面的:
用javascript语句来控制action是a.asp还是b.asp
<form action="" method="post" name="myform">
<input type="submit" class="button" name="Submit1" value=" 确 定 " />
<input type="submit" class="button" name="Submit2" value=" 确 定 "
</form>
<script language="javascript" type="text/javascript">
function SelSubmit1()
{
document.myform.action='a.asp';
document.myform.submit();
}
function SelSubmit2()
{
document.myform.action='b.asp';
document.myform.submit();
}
</script>
<form action="" method="post" name="myform">
<input type="submit" class="button" name="Submit1" value=" 确 定 " />
<input type="submit" class="button" name="Submit2" value=" 确 定 "
</form>
<script language="javascript" type="text/javascript">
function SelSubmit1()
{
document.myform.action='a.asp';
document.myform.submit();
}
function SelSubmit2()
{
document.myform.action='b.asp';
document.myform.submit();
}
</script>
本文转自terryli51CTO博客,原文链接: http://blog.51cto.com/terryli/519577,如需转载请自行联系原作者