1
|
<!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(); } ipt>
|
一个form表单中两个(或多个)提交按钮,分别提交到不同页面或者不同方法的实现方法
未经允许不得转载:主机百科 » 一个form表单中两个(或多个)提交按钮,分别提交到不同页面或者不同方法的实现方法