希望对你有帮助! (我只给出了html部分,你应该会修改成asp吧?)

解决方案 »

  1.   

    不好意思,忘了贴代码:)
    <html>
    <head>
    <title>入库记录查询 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="CssLib/TOOLBARS.CSS" rel="stylesheet" type="text/css">
    <script language="javascript">
    <!--
    function validate()
    {
        var t=0
        var c, d, e,f,g,h    c=parseInt(document.form1.s_year.value)
    d=parseInt(document.form1.s_month.value)
        e=parseInt(document.form1.s_day.value)
        f=parseInt(document.form1.e_year.value)
        g=parseInt(document.form1.e_month.value)
        h=parseInt(document.form1.e_day.value)//*********************查询时,年月日要么都填,要么都不填,不能只填写其中一项进行查询.******************   if ((document.form1 .s_year .value =="" || document.form1 .s_month .value =="" || document.form1 .s_day .value =="" || document.form1 .e_year .value =="" || document.form1 .e_month .value =="" || document.form1 .e_day .value =="") && (document.form1 .s_year .value !="" || document.form1 .s_month .value !="" || document.form1.s_day .value !="" || document.form1 .e_year .value !="" || document.form1 .e_month .value !="" || document.form1 .e_day .value !="") && (t!=1))
           {
                  alert("年月日填写不完整!")
                  t=1
           }//**********************************************************************************************************     if (document.form1.s_year.value!="" && document.form1 .s_month .value !="" && document.form1 .s_day .value !="" && document.form1.e_year.value!="" && document.form1 .e_month .value !="" && document.form1 .e_day .value !="" && t!=1)
              {
                     if (t!=1 && (c>3000 || c<1000 ))
                           {
                                 window.alert( "起始年超出范围")
                                 t=1                        }
                     if (t!=1 &&  (d>12 || d<1))
                          {
                                window.alert( "起始月超出范围")
                                t=1                       }
                    if (t!=1 &&  ( e>31 || e<1))
                         {
                               window.alert( "起始日超出范围")
                               t=1                      }
                   if (t!=1 && (f>3000 || f<1000 ))
                           {
                                 window.alert( "结束年超出范围")
                                 t=1                        }
                     if (t!=1 &&  (g>12 || g<1))
                          {
                                window.alert( "结束月超出范围")
                                t=1                       }
                    if (t!=1 &&  ( h>31 || h<1))
                         {
                               window.alert( "结束日超出范围")
                               t=1                      }
              }
         if (t!=1)
            {
               document.form1 .method ="post"
               document.form1.action=""
               document.form1.submit()
            }
    }
    //-->
    </script>
    </head><body bgcolor="#deebff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <br>
    <table width="80%" border="0" align="center" cellpadding="2" cellspacing="0">
      <tr>
        <td> <div align="center"><strong>入库记录查询 </strong> </div>
          <div align="center"></div></td>
      </tr>
    </table>
    <form name="form1">
      <div align="center">
        <table width="51%" height="203" border="1" cellpadding="2" cellspacing="0">
          <tr>
            <td><div align="center">
                <select name="bh" >
                  <option value="1">物资名称</option>
                  <option value="2">规格型号</option>
                </select>
              </div></td>
            <td><div align="center">
                <input type="text" name="textfield">
              </div></td>
          </tr>
          <tr>
            <td><div align="center">入库人:</div></td>
            <td><div align="center">
                <input type="text" name="psnname">
              </div></td>
          </tr>
          <tr>
            <td><div align="center">入库日期:</div></td>
            <td><div align="center">从
                <input name="s_year" type="text" size="4" maxlength="4">
                年
                <input name="s_month" type="text" size="2" maxlength="2">
                月
                <input name="s_day" type="text" size="2" maxlength="2">
                日 </div></td>
            <td><div align="center">到
                <input name="e_year" type="text" size="4" maxlength="4">
                年
                <input name="e_month" type="text" size="2" maxlength="2">
                月
                <input name="e_day" type="text" size="2" maxlength="2">
                日 </div></td>
          </tr>
        </table>
        <br>
        <table width="148" height="42" border="0" cellpadding="2" cellspacing="0">
          <tr>
            <td><div align="center">
                <input type="button" name="button1" value="查询" onclick="validate()">
              </div></td>
            <td><div align="center">
                <input type="reset" name="cancel" value="取消">
              </div></td>
          </tr>
        </table>
      </div>
    </form><script language="JavaScript">
    <!--
    if (document.layers)
    document.captureEvents(event.KeyPress);
    function blockA(e) {
    if (document.layers)
            var keyChar =e.which;
    if (document.all)
            var keyChar =event.keyCode;
    if (keyChar>57 || keyChar<48)
    {
    alert('请输入数字!');
    return false;
    }
    }
    document.form1.s_year.onkeypress = blockA;
    document.form1.s_month.onkeypress = blockA;
    document.form1.s_day.onkeypress = blockA;
    document.form1.e_year.onkeypress = blockA;
    document.form1.e_month.onkeypress = blockA;
    document.form1.e_day.onkeypress = blockA;
    //-->
    </script></body>
    </html>