Recommended: Examples of ASP Basic Tutorial Learning ASP Response Objects The ASP Response object is used to send output results from the server to the user. Examples Use ASP to write text This example demonstrates how to use ASP to write text. The following is the quoted content: <html><
| The following is the quoted content: <style> td { font-family: font-family; font-size:9pt} </style> <body bgcolor=eeeeee> <table width=180 cellpadding=0 cellpacing=1 bgcolor=dddddd align=center> <% 'The following is the specific code implemented by this calendar algorithm in ASP 'First determine whether a year and month are specified, and if not, it will be displayed according to the current year and month If Request(ReqDate)= then CurrentDate=Date else CurrentDate=Trim(Request(ReqDate)) end if pyear=year(CurrentDate) pmonth=month(CurrentDate) 'The following code generates the table header content displayed by the calendar %> <tr align=LEFT bgcolor=#dddddd> <td width=14% height=19 align=center> <input type=button value=<< onclick=JavaScript:location.href='?ReqDate=<%=DateAdd(m,-1,CurrentDate) %>'> </td> <td colspan=5 align=center> <%=pyear%>year<%=pmonth%>month </td> <td width=14% align=center> <input type=button value=>> onclick=JavaScript:location.href='?ReqDate=<%=DateAdd(m,1,CurrentDate)%>'> </td> </tr> <tr align=center bgcolor=#CCCCCC> <td width=14% height=19>Day</td> <td width=14%> 1</td> <td width=14%> 2</td> <td width=14%> Three</td> <td width=14%> 4</td> <td width=14%> Five</td> <td width=14%> Six</td> </tr> <tr align=center bgcolor=ffffff height=19> <% 'Since there is no function in ASP to obtain how many days there is in a specified month, we need to obtain it through other algorithms. The algorithm is actually very simple, which is to calculate how many days the difference between the 1st day of the month and the 1st day of the next month. fromDate = FormatDateTime(month(CurrentDate) & /1/ & year(CurrentDate)) toDate = FormatDateTime(DateAdd(m,1,fromDate)) 'Get the first day of the month to show the week nunmonthstart=weekday(fromDate)-1 'Get the total difference between the 1st day to the 1st day of the next month (how many days are there in the month) nunmonthend=DateDiff(d,fromDate,toDate) 'How many rows of tables are needed to be displayed to determine the calendar (7 days per row) if nunmonthstart nunmonthend<36 then maxi=36 else maxi=43 end if 'Change to generate the table and display it i=1 do while i<maxi iv=i-nunmonthstart if i>nunmonthstart and i<=nunmonthend nunmonthstart then 'If it is displayed today, use a red background if iv=Day(now) and month(now)=pmonth and year(now)=pyear then response.write( <td align=center bgcolor=ffaaa><a href='#' target=_blank> & iv & </a></td>) else response.write( <td align=center><a href='#' target=_blank> & iv & </a></td>) end if else response.write( <td> </td>) end if 'If it can be divided by 7 (7 are displayed per line), output a new line if i mod 7=0 then response.write( </tr><tr align=center bgcolor=ffffff height=19>) end if i=i 1 loop %> </table> </body> |
Share: ASP 3.0 Advanced Programming (43) 9.3.5 Data Caching First of all, it is important to note that although both data cache and record set cache are used to improve performance, the two are irrelevant. Data cache is a temporary data storage area that allows the use of data in the cache instead of regenerating new numbers.