日期:2009-03-21  浏览次数:20874 次

以后,要是做时间段的查询就方便了,不过就是程序有点多,呵呵!

希望大家能帮我测试一下,输入的时间格式是1999-01-01或2000-10-01或2000-10-10,即月份和时间必须是两位,为了方便大家测试,把所有文件放在这里,只要运行time_main.asp就可以了,多谢了!



time_main.asp

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>

<FRAMESET ROWS="82,18" border=1>
    <FRAME NAME="time" SRC="time.asp">
    <FRAME NAME="time_search" SRC="time_search.asp">
</FRAMESET>
<NOFRAMES>您的浏览器不支持FRAMES</NOFRAMES>

</HTML>




time.asp
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<%
    starttime = Request.Form("starttime")
    endtime = Request.Form("endtime")
    
    Response.Write starttime&"<br>"
    Response.Write endtime&"<br>"
    
%>
请点击“查询”按钮

</BODY>
</HTML>





time_search.asp
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<center>
<form name="tform" method="post">
按时间(以<font color=red>[YYYY-MM-DD]</font>格式输入):
<input type="text" name="starttime" size=10 maxlength=10 value="1999-01-02">到
<input type="text" name="endtime" size=10 maxlength=10 value="2000-01-01">
<input type="button" name="tsearch" value="查  询" onclick="return tcheck()">
</form>
</center>

<script language="javascript">
<!--
    function tcheck()
    {
        if (window.document.tform.starttime.value != "")
        {
            var vDate,vYear,vMonth,vDay;
            vDate = window.document.tform.starttime.value;
            vYear = vDate.substring(0,4);
            if (isNaN(vYear) || vYear < 1900)
            {
                window.alert("您的日期1输入有误!");
                tform.starttime.focus();
                return false;
            }
            vMonth = vDate.substring(5,7);
            if (isNaN(vMonth) || vMonth < 01 || vMonth > 12)
            {
                window.alert("您的日期1输入有误!");
           &n