|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我想详细了解ASP整站代码与PSP整站代码有什么优缺点,那个更好,更安全,更用容易维护,和管理。。。程序|日历亮显现当天,可以拔取某天显现,并可以到场事务。
<%
*******************************************************
*ASP101SampleCode-http://www.asp101.com*
**
*Thiscodeismadeavailableasaservicetoour*
*visitorsandisprovidedstrictlyforthe*
*purposeofillustration.*
**
*Pleasedirectallinquiriestowebmaster@asp101.com*
*******************************************************
%>
<%
***BeginFunctionDeclaration***
NewandimprovedGetDaysInMonthimplementation.
ThankstoFlorentRenucciforpointingoutthatI
couldeasilyusethesamemethodIusedforthe
revisedGetWeekdayMonthStartsOnfunction.
FunctionGetDaysInMonth(iMonth,iYear)
DimdTemp
dTemp=DateAdd("d",-1,DateSerial(iYear,iMonth+1,1))
GetDaysInMonth=Day(dTemp)
EndFunction
PreviousimplementationonGetDaysInMonth
FunctionGetDaysInMonth(iMonth,iYear)
SelectCaseiMonth
Case1,3,5,7,8,10,12
GetDaysInMonth=31
Case4,6,9,11
GetDaysInMonth=30
Case2
IfIsDate("February29,"&iYear)Then
GetDaysInMonth=29
Else
GetDaysInMonth=28
EndIf
EndSelect
EndFunction
FunctionGetWeekdayMonthStartsOn(dAnyDayInTheMonth)
DimdTemp
dTemp=DateAdd("d",-(Day(dAnyDayInTheMonth)-1),dAnyDayInTheMonth)
GetWeekdayMonthStartsOn=WeekDay(dTemp)
EndFunction
FunctionSubtractOneMonth(dDate)
SubtractOneMonth=DateAdd("m",-1,dDate)
EndFunction
FunctionAddOneMonth(dDate)
AddOneMonth=DateAdd("m",1,dDate)
EndFunction
***EndFunctionDeclaration***
DimdDateDateweredisplayingcalendarfor
DimiDIMDaysInMonth
DimiDOWDayOfWeekthatmonthstartson
DimiCurrentVariableweusetoholdcurrentdayofmonthaswewritetable
DimiPositionVariableweusetoholdcurrentpositionintable
Getselecteddate.Therearetwowaystodothis.
FirstcheckifwewerepassedafulldateinRQS("date").
Ifsouseit,ifnotlookforseperatevariables,puttingthemtogeterintoadate.
Lastlycheckifthedateisvalid...ifnotusetoday
IfIsDate(Request.QueryString("date"))Then
dDate=CDate(Request.QueryString("date"))
Else
IfIsDate(Request.QueryString("month")&"-"&Request.QueryString("day")&"-"&
Request.QueryString("year"))Then
dDate=CDate(Request.QueryString("month")&"-"&Request.QueryString("day")&"-"
&Request.QueryString("year"))
Else
dDate=Date()
TheannoyinglybadsolutionforthoseofyourunningIIS3
IfLen(Request.QueryString("month"))0OrLen(Request.QueryString("day"))0Or
Len(Request.QueryString("year"))0OrLen(Request.QueryString("date"))0Then
Response.Write"Thedateyoupickedwasnotavaliddate.Thecalendar
wassettotodaysdate.<BR><BR>"
EndIf
TheelegantsolutionforthoseofyourunningIIS4
IfRequest.QueryString.Count0ThenResponse.Write"Thedateyoupickedwasnot
avaliddate.Thecalendarwassettotodaysdate.<BR><BR>"
EndIf
EndIf
Nowwevegotthedate.NowgetDaysinthechoosenmonthandthedayoftheweekitstartson.
iDIM=GetDaysInMonth(Month(dDate),Year(dDate))
iDOW=GetWeekdayMonthStartsOn(dDate)
%>
<!--OuterTableissimplytogettheprettyborder-->
<TABLEBORDER=10CELLSPACING=0CELLPADDING=0>
<TR>
<TD>
<TABLEBORDER=1CELLSPACING=0CELLPADDING=1BGCOLOR=#99CCFF>
<TR>
<TDBGCOLOR=#000099ALIGN="center"COLSPAN=7>
<TABLEWIDTH=100%BORDER=0CELLSPACING=0CELLPADDING=0>
<TR>
<TDALIGN="right"><AHREF="./calendar.asp?date=<%=
SubtractOneMonth(dDate)%>"><FONTCOLOR=#FFFF00SIZE="-1"><<</FONT></A></TD>
<TDALIGN="center"><FONTCOLOR=#FFFF00></p>结论:和PHP一样,ASP简单而易于维护,很适合小型网站应用,通过DCOM和MTS技术,ASP甚至还可以完成小规模的企业应用,但ASP的致命缺点就是不支持跨平台的系统,在大型项目开发和维护上非常困难。 |
|