频道直达 - 学院 - 下载 - 交易 - 特效 - 字库 - 手册 -排名-工具- 繁體
网页教学网站开发 设为首页
加入收藏
联系我们
建站搜索: 常用广告代码   用户注册 | 用户登陆
您当前的位置:中国建站之家 -> 网站开发设计技术教程 -> asp教程 -> ASP中时间采集源程序

ASP中时间采集源程序

作者:未知  来源:转载  发布时间:2005-9-18 0:20:32  发布人:acx

减小字体 增大字体


     This is an ASP page, which is supposed to be opened in a new browser window, it automatically resizes
to a client's resolution, displaying month view with a possibility to pick a date, which is then inserted
into a opener page control (like input type "text" control), whose reference is passed as an argument to
this ASP page


  

code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!



    '**************************************
    ' Name: ASP Date Picker
    ' Description:This is an ASP page, which
    '     is supposed to be opened in a new browse
    '     r window, it automatically resizes to a
    '     client's resolution, displaying month vi
    '     ew with a possibility to pick a date, wh
    '     ich is then inserted into a opener page
    '     control (like input type "text" control)
    '     , whose reference is passed as an argume
    '     nt to this ASP page
    ' By: Vadim Maslov
    '
    '
    ' Inputs:2 possible input arguments: dat
    '     e to display month for (if none - today'
    '     s month is automatic default) + opener p
    '     age control name: calendar.asp?date=10/1
    '     2/2000&ctl=calendar
    '
    ' Returns:None
    '
    'Assumes:None
    '
    'Side Effects:Code probably needs to be
    '     adjusted if a server's Regional settings
    '     are not American
    '
    'Warranty:
    'code provided by Planet Source Code(tm)
    '     (www.Planet-Source-Code.com) 'as is', wi
    '     thout warranties as to performance, fitn
    '     ess, merchantability,and any other warra
    '     nty (whether expressed or implied).
    'Terms of Agreement:
    'By using this source code, you agree to
    '     the following terms...
    ' 1) You may use this source code in per
    '     sonal projects and may compile it into a
    '     n .exe/.dll/.ocx and distribute it in bi
    '     nary format freely and with no charge.
    ' 2) You MAY NOT redistribute this sourc
    '     e code (for example to a web site) witho
    '     ut written permission from the original
    '     author.Failure to do so is a violation o
    '     f copyright laws.
    ' 3) You may link to this code from anot
    '     her website, provided it is not wrapped
    '     in a frame.
    ' 4) The author of this code may have re
    '     tained certain additional copyright righ
    '     ts.If so, this is indicated in the autho
    '     r's description.
    '**************************************
    
    <%@ Language=VBscript %>
    <%
    Option Explicit
    Const TOP_COORDINATE = 30
    Dim curDate
    Dim daysCount
    Dim lastDay
    Dim firstDay
    Dim i
    Dim topC
    Dim leftC
    Dim tempDate
    Dim curMonth
    Dim curYear
    Dim calHTML
    Dim pDate
    Dim curMonthText
    Dim rowCount
    Dim nextMonth
    Dim prevMonth
    Dim retControl
     curDate = Request("date")
     retControl = Request("ctl")
     If IsDate(curDate) Then pDate = FormatDateTime(curDate, 0)
     If curDate = "" Then
     curDate = Now()
     Else
     If IsDate(curDate) Then curDate = Month(curDate) & "/" & Day(curDate) & "/" & Year
(curDate)
     End If
     If IsDate(curDate) Then
     curMonth = Month(curDate)
     curMonthText = TextMonth(curMonth) & "-" & Year(curDate)
     curYear = Year(curDate)
     firstDay = curMonth & "/" & "01" & "/" & curYear
     lastDay = DateAdd("d", -1, DateAdd("m", 1, firstDay))
     nextMonth = DateAdd("m", 1, firstDay)
     nextMonth = FormatDateTime(Month(nextMonth) & "/" & Day(curDate) & "/" & Year
(nextMonth), 0) & _
     "&ctl=" & retControl
     prevMonth = DateAdd("m", -1, firstDay)
     prevMonth = FormatDateTime(Month(prevMonth) & "/" & Day(curDate) & "/" & Year
(prevMonth), 0) & _
     "&ctl=" & retControl
     daysCount = CInt(Day(lastDay))
     For i = 1 To daysCount
     tempDate = curMonth & "/" & i & "/" & curYear
     leftC = calcLeft(DatePart("w", tempDate, vbMonday))
     topC = calcTop(tempDate)
     calHTML = calHTML & _
     "<DIV style='text-align: center; position: absolute; width: 50px; left: "
& leftC & "px; top: " & topC & _
     "px; font-family: Tahoma, Arial; cursor: hand; "
     If FormatDateTime(tempDate, vbShortDate) = FormatDateTime(Now,
vbShortDate) Then
     calHTML = calHTML & "background-color: orange; color: white"
     Else
     calHTML = calHTML & "background-color: #faf0e6; color: black"
     End If
     If FormatDateTime(tempDate, vbShortDate) = FormatDateTime(pDate,
vbShortDate) Then
     calHTML = calHTML & "; border: solid blue 1px"
     End If
     calHTML = calHTML & "' onClick=" & Chr(34) & "onDateSelected('" & _
     fNumber(Month(tempDate)) & "/" & fNumber(Day(tempDate)) & "/" & Year
(tempDate) & _
     "')" & Chr(34) & ">" & Day(tempDate) & "</DIV>" & vbCrLf
     Next
     End If
    Function fNumber(fNum)
     If Len(Cstr(fNum)) < 2 Then
     fNumber = "0" & Cstr(fNum)
     Else
     fNumber = fNum
     End If
    End Function
    Function calcLeft(wDay)
     calcLeft = ((wDay - 1) * 50) + 2
    End Function
    Function calcTop(wDate)
    
     Dim mStartDate
     Dim mStartWeekDay
     Dim dRow
     mStartDate = Month(wDate) & "/" & "01/" & Year(wDate)
     mStartWeekDay = DatePart("w", mStartDate, vbMonday)
     dRow = ((mStartWeekDay + CInt(DateDiff("d", mStartDate, wDate))) \ 7) + 1
     If WeekDay(wDate, vbMonday) = 7 Then dRow = dRow - 1
     calcTop = ((dRow - 1) * 20) + 1 + TOP_COORDINATE
     If dRow > rowCount Then rowCount = dRow
    End Function
    Function TextMonth(dMonth)
     Select Case dMonth
     Case 1: TextMonth = "January"
     Case 2: TextMonth = "February"
     Case 3: TextMonth = "March"
     Case 4: TextMonth = "April"
     Case 5: TextMonth = "May"
     Case 6: TextMonth = "June"
     Case 7: TextMonth = "July"
     Case 8: TextMonth = "August"
     Case 9: TextMonth = "September"
     Case 10: TextMonth = "October"
     Case 11: TextMonth = "November"
     Case 12: TextMonth = "December"
     End Select
    End Function
    %>
    <HTML>
    <HEAD>
    <TITLE>Date picker</TITLE>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <LINK REL="stylesheet" TYPE="text/css" HREF="../site_css.css">
    <script language="Javascript">
     Function onDateSelected(lDate) {
     var cObj = eval("opener.window.document." + hostCtl.value);
     If (cObj != null) {
     cObj.value = lDate;
     cObj.focus();
     }
     self.window.close();
     }window.open
     Function initPos() {
     curMonth.style.top = (calRows.value * 20) + 30;
     window.resizeTo(360, parseInt(curMonth.style.top, 10) + parseInt
(curMonth.clientHeight, 10) + 50);
     }
    </script>
    </HEAD>
    <BODY topmargin="0" leftmargin="0" onLoad="initPos()">
    <INPUT type="hidden" id="calRows" name="calRows" value="<%=rowCount%>">
    <INPUT type="hidden" id="hostCtl" name="hostCtl" value="<%=retControl%>">
    <DIV style="position: absolute; left: 2px; top: 2px; width: 350px">
    <TABLE width="350">
    <TR style="background-color: darkblue; color: white">
     <TD width="50" align="center"><B>mon</B></TD>
     <TD width="50" align="center"><B>tue</B></TD>
     <TD width="50" align="center"><B>wed</B></TD>
     <TD width="50" align="center"><B>thu</B></TD>
     <TD width="50" align="center"><B>fri</B></TD>
     <TD width="50" align="center"><B>sat</B></TD>
     <TD width="50" align="center"><B>sun</B></TD>
    </TR>
    </TABLE>
    <%=calHTML%>
    </DIV>
    <DIV id="curMonth" style="position: absolute; left: 2px; width: 350px; text-align: center;">
    <TABLE width="350">
     <TR style="background-color: black; color: white">
     <TD width="100"><A href="calendar.asp?date=<%=prevMonth%>">Previous</A></TD>
     <TD align="center" width="150"><B><%=curMonthText%></B></TD>
     <TD width="100" align="right"><A href="calendar.asp?date=<%=nextMonth%
>">Next</A></TD>
     </TR>
    </TABLE>
    </DIV>
    </BODY>
    </HTML>

将本文收藏到QQ书签与更多好友分享
[打 印]
[] [返回上一页] [收 藏]
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
精彩推荐
热门文章
· 注册码大全二
· 注册码大全四
· 注册码大全一
· 要10G免费网络硬盘的请进..
· 通过google 赶快来赚美金..
· 注册码大全十
· 头像-qq头像(qq新头像)4..
· 让你轻松架设FTP服务器1..
· 注册码大全三
· 梦幻背景图片7
· 卡通动物图片6
· 网页制作素材-按钮素材2..
· 让你轻松架设FTP服务器5..
· 风景图片8
· 注册码大全九
· 让你轻松架设FTP服务器2..
关注此文读者还看过
· CHANet联盟
· Access数据库技术(35)
· 《PHP程序设计》 第五章..
· 通过ASP与ACCESS数据库建..
· 百度、谷歌搜索引擎原理..
· “打假”网站揭招聘黑幕..
· Flash MX 文本工具手册(..
· 百度搜索结果广告漫天飞..
· 网络教师渐成家教新宠 市..
· 盛大否认裁员说 陈天桥休..
· ASP调用SQL SERVER存储程..
· Flash入门应该了解的重要..
· 菜鸟也能架设FTP服务器 ..
· 使用ASP.NET控件进行程序..
· 自己动手画玻璃砖墙
· 《武林外传》被指"抄袭"..
相关文章
· ASP中FSO的神奇功能 - 文件..
· 通过实例讲解来学习ASP中的..
· ASP基础教程之学习ASP中子程..
· 实例详细讲解ASP教程之ASP中..
· asp中的多条件组合查询实现..
· 关于Asp中代码与页面的分离..
· 技巧:ASP中用Request对象获..
· 浅谈ASP中Web页面间的数据传..
· ASP中各种数据库连接代码
· 轻松实现ASP中页面限权访问..
· 轻松实现ASP中页面限权访问..
· 轻松实现ASP中页面限权访问..
· 在ASP中使用事务控制
· 在ASP中常见的错误80004005..
· Asp中如何快速分页!
· 在ASP中使用SQL语句之7:ORD..
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 人才招聘
网站合作、内容监督、商务咨询:QQ: 9576619
Copyright ? 2005--2008 中国建站之家版权所有
粤ICP备05092265号