一个form两个submit,提交不同的地址

本文介绍了一种使用JavaScript来改变HTML表单提交行为的方法。通过设置表单元素的method属性为'post'并指定不同的action属性值,可以实现点击按钮后提交到不同页面的功能。需要注意的是,必须使用type='submit'才能正确触发表单提交。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<script language= "JavaScript ">
<!--Begin
function appliy(){
document.form1.method= "post ";
document.form1.action= "appliy.asp ";
document.form1.submit();
return true;
}

function ali(){
document.form1.method= "post ";
document.form1.action= "ali.asp ";
document.form1.submit();
return true;
}
//End-->
</script>
</head>
<form name="form1">
<input [color=red]type= "submit" [/color] name= "pev " value= "支付宝支付 " onClick= "appliy() ">
<input [color=red]type= "submit " [/color] name= "next " value= "阿里巴巴 " onClick= "ali() ">
</form>

注意必须为submit,用button是提交不上的,哦
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值