<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>一个form表单,两个提交按钮</title>
</head>
<body>
<form action="" name="pay" method="post">
姓名:<input type="text" name="name"/><br/>
单价:<input type="text" name="price"/><br/>
数量:<input type="text" name="num"/><br/>
总金额:<input type="text" name="total_fee"/><br/>
<button onclick="send(1)"/>在线支付</button>
<button onclick="send(2)"/>货到付款</button>
</form>
</body>
</html>
<script>
function send(type) {
var url = '';
if(type === 1){
url = 'zaixianzhifu';
}else{
url = 'huodaofukuan';
}
document.pay.action = url;
document.pay.submit();
}
</script>
(adsbygoogle = window.adsbygoogle || []).push({});
来源:https://www.02405.com/archives/1649