ASP日历类

<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''                                                               ''''
''''  Calendar Version 1.0                                         ''''
''''      by Xinsoft, 2004-10-22                                   ''''
''''      Blogchina.COM & ChinaLabs.COM                            ''''
''''                                                               ''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Class Calendar

Public Lang
Public DateVal

Public PrevYLink,NextYLink
Public PrevMLink,NextMLink

'''' Temp Var

Private pWeekdaysText

'''' HTML Parameters

Public LinkStyleClass

Public Table_class
Public Table_width
Public Table_bgColor

Public Table_Title_style
Public Table_Title_bgColor
Private Table_Title_Text

Public tdBgColor_Light
Public tdBgColor_Dark
Public tdBgColor_Gray

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
''''      meta functions
''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub Print( str )
Response.Write str & vbCrlf
End Sub
Private Sub Echo( str )
Response.Write str
End Sub
Private Sub EchoPara( str , val )
If ""<>""&val Then Response.Write " " & str & "="""& val &""""
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
''''      HTML functions
''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub PrintTableHead
Echo "<table"

EchoPara "class"      , Table_class
EchoPara "width"      , Table_width
EchoPara "bgColor"      , Table_bgColor

Echo " cellSpacing=""1"" cellPadding=""1"""
Echo " align=""center"""
Echo " border=""0"""

Print "><tbody>"
End Sub
Private Sub PrintTableTail
Print ""
Echo "</tbody></table>"
End Sub
Private Sub PrintTableTitle
Print "<tr>"
Echo "<td"
EchoPara "style"      , Table_Title_style
EchoPara "bgColor"      , Table_Title_bgColor
EchoPara "colspan"      , "7"
Echo ">"

Echo " <b>" & Table_Title_Text & "</b>"

Print "</td>"
Print "</tr>"
End Sub

Private sub SetWeekdaysText_CHS()
pWeekdaysText(0)="日"
pWeekdaysText(1)="一"
pWeekdaysText(2)="二"
pWeekdaysText(3)="三"
pWeekdaysText(4)="四"
pWeekdaysText(5)="五"
pWeekdaysText(6)="六"
End Sub
Private sub SetWeekdaysText_ENU()
pWeekdaysText(0)="Su"
pWeekdaysText(1)="M"
pWeekdaysText(2)="Tu"
pWeekdaysText(3)="W"
pWeekdaysText(4)="Th"
pWeekdaysText(5)="F"
pWeekdaysText(6)="Sa"
End sub
Private sub SetWeekdaysText()
Select Case Lang
Case "CHS" : SetWeekdaysText_CHS
Case "ENU" : SetWeekdaysText_ENU
Case Else  : SetWeekdaysText_ENU
End select
End Sub

Private function MonthText_CHS( monthval )
Dim Str
If monthval<10 Then
Str="0"&monthval
Else
Str=monthval
End If
MonthText_CHS=Str & "月"
End function
Private function MonthText_ENU( monthval )
Select Case ""&monthval
Case  "1" : MonthText_ENU="January"
Case  "2" : MonthText_ENU="February"
Case  "3" : MonthText_ENU="March"
Case  "4" : MonthText_ENU="April"
Case  "5" : MonthText_ENU="May"
Case  "6" : MonthText_ENU="June"
Case  "7" : MonthText_ENU="July"
Case  "8" : MonthText_ENU="August"
Case  "9" : MonthText_ENU="September"
Case "10" : MonthText_ENU="October"
Case "11" : MonthText_ENU="November"
Case "12" : MonthText_ENU="December"
End select
End Function
Private function MonthText( monthval )
Select Case Lang
Case "CHS" : MonthText=MonthText_CHS( monthval )
Case Else  : MonthText=MonthText_ENU( monthval )
End select
End Function
Private function YearText( yearval )
Select Case Lang
Case "CHS" : YearText=yearval & "年"
Case Else  : YearText=yearval
End select
End function

Private sub SetTable_Title_Text()
Dim monthval
monthval=Month(DateVal)

Dim yeartext
yeartext=Year(DateVal)
Select Case Lang
Case "CHS" : yeartext=yeartext&"年"
Case Else  : yeartext=yeartext
End Select

Dim daytext
daytext=Day(DateVal)
If 10>daytext Then daytext="0" & daytext

Select Case Lang
Case "CHS" : Table_Title_Text=MonthText_CHS( monthval )
Case Else  : Table_Title_Text=MonthText_ENU( monthval )
End Select

Select Case Lang
Case "CHS" : Table_Title_Text=yeartext & Table_Title_Text & daytext & "日"
Case Else  : Table_Title_Text=Table_Title_Text &" "& Day(DateVal) & " , " & yeartext
End select
End Sub

Private Sub PrintWeekdaysTR()
Dim i
Print "<tr>"

For i=0 To 6
Echo "<td"
EchoPara "align"      , "center"
EchoPara "valign"      , "middle"
EchoPara "bgColor"  , tdBgColor_Dark
Echo ">"

Select Case Lang
Case "CHS" : Echo pWeekdaysText(i)
Case "ENU" : Echo "<b>" & pWeekdaysText(i) & "</b>"
Case Else  : Echo "<b>" & pWeekdaysText(i) & "</b>"
End select

Echo "</td>"
Next

Print "</tr>"
End Sub

Private Sub PrintYMChooser()
Dim M,Y
M=Month(DateVal)
Y=Year(DateVal)

Print "<tr>"

Echo "<td"
EchoPara "align","center"
EchoPara "valign","middle"
EchoPara "bgColor",tdBgColor_Dark
EchoPara "colspan","7"
Echo ">"

'''' Year chooser
Echo "<a"
EchoPara "class",LinkStyleClass
EchoPara "href",PrevYLink
Echo ">"
Echo "<span style=""FONT-FAMILY: webdings"">3</span></a><b>"& YearText(Y) &"</b>"
Echo "<a"
EchoPara "class",LinkStyleClass
EchoPara "href",NextYLink
Echo "</td>"
Echo "<span style=""FONT-FAMILY: webdings"">4</span></a>"

Echo "  "

'''' Month chooser
Echo "<a"
EchoPara "class",LinkStyleClass
EchoPara "href",PrevMLink
Echo ">"
Echo "<span style=""FONT-FAMILY: webdings"">3</span></a><b>"& MonthText(M) &"</b>"
Echo "<a"
EchoPara "class",LinkStyleClass
EchoPara "href",NextMLink
Echo "</td>"
Echo "<span style=""FONT-FAMILY: webdings"">4</span></a>"

Print "</tr>"
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
''''      Date Functions
''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private curY,curM,curD
Private curM_BeginDateVal,curM_EndDateVal
Private curM_DaysCount
Private curM_BeginWeekday,curM_EndWeekday
Private curM_Begin_LeftDays,curM_End_RightDays
Private curM_TDCount,curM_Lines
Private CellArray,CellX,CellY
Public ItemDate
Public ItemText
Public ItemLink
Public ItemBG

Public Function Idx2D_1D( x,y )
Idx2D_1D=CellX*y+x - curM_Begin_LeftDays

If Idx2D_1D<0 Then Idx2D_1D=-1
If Idx2D_1D>=curM_DaysCount Then Idx2D_1D=-2

End function

Private Sub InitDatePara()
curY=Year(DateVal)
curM=Month(DateVal)
curD=day(DateVal)

curM_BeginDateVal=curY&"-"&curM&"-1"
curM_EndDateVal=DateAdd( "m" , 1 , curM_BeginDateVal )
curM_EndDateVal=DateAdd( "d" ,-1 , curM_EndDateVal )
curM_DaysCount=DateDiff( "d" , curM_BeginDateVal , curM_EndDateVal  )+1
curM_BeginWeekday =Weekday(curM_BeginDateVal , 1 )
curM_EndWeekday   =Weekday(curM_EndDateVal   , 1 )
curM_Begin_LeftDays =curM_BeginWeekday-1
curM_End_RightDays  =7 - curM_EndWeekday
curM_TDCount=curM_DaysCount + curM_Begin_LeftDays + curM_End_RightDays
curM_Lines  =curM_TDCount/7

CellX=7
CellY=curM_Lines
ReDim CellArray( CellX,CellY )

ReDim ItemDate(curM_DaysCount)
ReDim ItemText(curM_DaysCount)
ReDim ItemLink(curM_DaysCount)
ReDim ItemBG(curM_DaysCount)

Dim i,j

For i=0 To curM_DaysCount-1
ItemDate(i)=curY&"-"&curM&"-"&CStr(i+1)
ItemText(i)=CStr(i+1)
ItemLink(i)=""
ItemBG(i)  =tdBgColor_Light
If curD=i+1 Then ItemBG(i)=tdBgColor_Gray
Next

End Sub

Property Let Date(g)
DateVal=g
InitDatePara
End Property

Private Sub PrintDayTDs()
Dim i,j
Dim x
For i=0 To CellY-1
Print "<tr>"

For j=0 To CellX-1
x=Idx2D_1D(j,i)
Echo "<td"
EchoPara "style",      "FONT-SIZE: 9px; FONT-FAMILY: sans-serif"
EchoPara "align",      "center"
EchoPara "valign",      "middle"
If x>=0 Then
EchoPara "bgColor",      ItemBG(x)
Else
EchoPara "bgColor",      "#ffffff"
End if

Echo ">"

If x>=0 Then
If ""=""&ItemLink(x) Then
Echo x+1
Else
Echo "<a"
EchoPara "href",ItemLink(x)
EchoPara "class",LinkStyleClass
Echo ">"
Echo x+1
Echo "</a>"
End if
Else
Echo "<img width=""0"" height=""0"" />"
End if

Print "</td>"

Next

Print "</tr>"
Next
End sub

Private Sub Class_Initialize

Lang="CHS"
DateVal=Now
InitDatePara

PrevYLink=""
NextYLink=""
PrevMLink=""
NextMLink=""

LinkStyleClass="calendar"

Table_class="caBox"
Table_width="180"
Table_bgColor="#c8ccc8"

Table_Title_style="FONT-SIZE: 9px; COLOR: #ffffff; FONT-FAMILY: sans-serif"
Table_Title_bgColor="#d56324"

tdBgColor_Light="#ffffff"
tdBgColor_Dark ="#f0f0f0"
tdBgColor_Gray ="#efefef"

ReDim pWeekdaysText(7)
SetWeekdaysText
End Sub
Private Sub Class_Terminate
End Sub

Public Sub Exec()
PrintTableHead

SetTable_Title_Text
PrintTableTitle

PrintWeekdaysTR
PrintDayTDs
PrintYMChooser

PrintTableTail
End sub

End class
%>

echo.................... 我汗。

时间: 2024-12-30 06:14:30

ASP日历类的相关文章

asp打包类

打包 <%On Error Resume NextDim rSet r = New Rar r.Add Server.MapPath("a.gIf")r.Add Server.MapPath("a.txt")r.Add Server.MapPath("test")r.Add Server.MapPath("file.asp")r.packname = Server.MapPath("xxx.dat")

删除lpt1.css.asp或com8.index.asp这类文件的方法

一般遇到lpt1.css.asp或com8.index.asp这类文件,都是黑客利用系统保留文件名创建的一些webshell.在Windows下不能以如下字样来命名文件或文件夹: aux|prn|con|nul|com1|com2|com3|com4|com5|com6|com7|com8|com9|lpt1|lpt2|lpt3|lpt4|lpt5|lpt6|lpt7|lpt8|lpt9 但是可以通过cmd的copy命令实现: D:wwwroot>copy rootkit.asp .D:wwwr

一个比较不错的PHP日历类分享_php实例

说到对时期和时间的处理,就一定要介绍一下日历程序的编写.但一提起编写日历,大多数人都会认为日历的作用只是为了在页上显示当前的日期,其实日历在我们的开发中有更重要的作用.例如我们开发一个"记事本"就需要通过日历设定日期,还有一些系统中需要按日期去排任务,也需要日历,等等.本例涉及的日期和时间函数并不是很多,都是前面介绍的内容,主要是通过一个日历类的编写,巩固一下前面介绍过的面向对象的语法知识,以及时间函数应用,最主要的是可以提升初学者的思维逻辑和程序设计能力.将日历类Calendar声明

ASP日志类和判断是否包涵JS脚本类

ASP日志类  代码如下 复制代码 Function WriteLogReg(Error_lerong)     On Error Resume Next     LogFileTmp = "Error.log"     Set tmpFsoR = Server.CreateObject("scripting.filesystemobject")     Set tmpLogR = tmpFsoR.OpentextFile(Server.MapPath(LogFil

哪里可以找到 asp.net 类的外文翻译?

问题描述 哪里可以找到asp.net类的外文翻译呢?找了半天没有合适的,想中文翻译过来5000字的,,新年快乐~! 解决方案 解决方案二:先顶啊不明白你什么意思?解决方案三:疯狂≮程序员≯网址:http://heshengxin.ys168.com/CC++JAVAC#.NET软件开发大家随便上传,没问题的代码大家一起分享,有问题的代码大家一起解决.疯狂≮程序员≯一Q群号码:3733191疯狂≮程序员≯二Q群号码:9951116

PHP实现的简单日历类_php技巧

本文实例讲述了PHP实现的简单日历类.分享给大家供大家参考. 具体实现代码如下: 复制代码 代码如下: date_default_timezone_set("etc/gmt-8"); header("Content-type: text/html; charset=utf-8"); class calendar{ var $t = array(); var $datesofmonth = array('1'=>'31','2'=>'28','3'=>

易心asp分页类 v1.0_ASP CLASS类

易心asp分页类v1.0 复制代码 代码如下: <%  class Ex_SplitPageCls  '==========================================================================  '易心asp分页类v1.0  '作者:易心 QQ:343931221  '个人网站 www.ex123.net www.bo56.com   '演示地址:www.ex123.net/show/page  '转载请保留此信息  '========

叶子asp分页类_ASP CLASS类

名称: 叶子asp分页类 Name: ShowoPage(vbs class) RCSfile: ReadMe.txt Revision: 0.12.20051114.f Author: Yehe(叶子) Released: 2005-11-14 09:40:13 Descript: ASP分页类,支持access/mssql/mysql/sqlite Contact: QQ:311673 MSN:myehe@msn.com GT:mmyehe@gmail.com WebSite: http:/

简单的php日历类控件代码实例

简单的php教程日历类控件代码实例 /* */ date_default_timezone_set("Etc/GMT-8"); class Calendar{ var $T = array(); var $datesOFmonth = array('1'=>'31','2'=>'28','3'=>'31','4'=>'30','5'=>'31','6'=>'30','7'=>'31','8'=>'31','9'=>'30','10'