提交表单的问题

来源:百度知道 编辑:UC知道 时间:2024/05/13 07:56:35
我的表单中有两个按钮,一个注册、一个提交!我想当点击两个按钮时把表单提交给不同的文件,请问怎么做?请说详细一点,我做的是JPS的网页

<html>
<head>
<script language="javascript">
function func(value){
if(value==1){
document.form1.action="注册.jsp";
}else if(value==2){
document.form1.action="提交.jsp";
}
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1" action="">
<input type=button value="注册" onclick="func(1);">
<input type=button value="提交" onclick="func(2);">
</form>
</body>
</html>

下面的改成你想要到的网页就行了。
if(value==1){
document.form1.action="注册.jsp";
}else if(value==2){
document.form1.action="提交.jsp";
}

<script language="javascript">
/////函数分开写便于控制不同的提交内容
function test_one(sub){
//其他
sub.action="注册.jsp";
sub.submit();
}
fun