国内外主机
测评及优惠码

一个form表单中两个(或多个)提交按钮,分别提交到不同页面或者不同方法的实现方法

  <!title="查看含有 doctype 标签的文章" target="_blank">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>
赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《一个form表单中两个(或多个)提交按钮,分别提交到不同页面或者不同方法的实现方法》
文章链接:https://www.ibytx.com/19316.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

登录

找回密码

注册