一個表單 兩個提交按鈕

第一種: post

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

 

第二種: orm

<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();"> get

 

第三種: input

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

<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();" /> io

</form> function

兩個按鈕的onclick: form

function CheckANDSeach() { class

   // 做一些必要的驗證
    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();   }

相關文章
相關標籤/搜索