ASP 一个表单 两个提交按钮

流过昼夜 提交于 2020-01-14 12:10:02

第一种:

第一个
onClick="document.form.action='a.asp';document.form.submit();"
第二个
onClick="document.form.action='b.asp';document.form.submit();"

 

第二种:

<input type="button" name="Submit" value="提交" onClick="form[this].action='a.asp';form[this].submit();">
<input type="button" name="Submit1" value="查看" onClick="form[this].action='b.asp';form[this].submit();">

 

第三种:

<form id="searchForm" name="searchForm" method="post" >

<input type="text" name="sDate" id="sDate" class="c_TextBoxCommon" value="<%= stDate %>" size="16" readonly="true" />
<input id="btnQuery" name="btnQuery" type="submit" class="btn"  value="开始查询"   onclick="searchForm.action='SatisfactionCount.asp';return CheckANDSeach();" />
<br />
<input id="btnQuery2" name="btnQuery2" type="submit" class="btn" value="导出数据" onclick="searchForm.action='export.asp';return ExportData();" />

</form>

两个按钮的onclick:

function CheckANDSeach() {

   // 作一些必要的验证
    var sdate = document.getElementById("sDate").value;
    var edate = document.getElementById("eDate").value;
    if (sdate !=' ' && edate !=' ') {
      var tmps = sdate.split("-");
      var tmpe = edate.split("-");
      sdate=new Date(tmps[0], tmps[1], tmps[2]);
      edate=new Date(tmpe[0], tmpe[1], tmpe[2]);
      if (edate<sdate) {
        alert ('开始时间不能大于结束时间!');
        return false;
      }
    }
 }


  function ExportData()
  {

  // 作一些必要的验证
     document.form.target ="_blank";
     document.form.submit();
  }

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!