<%@ Language=VBScript %>
<!--#include file="katalog/katalog.asp"-->
<% ' VI 6.0 Scripting Object Model Enabled %>
<!--#include file="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<form name="thisForm" METHOD="post">
<html>
<head>
<title>-->Annelie´s dagbok<--</title>
<script ID="serverEventHandlersVBS" LANGUAGE="vbscript" RUNAT="Server">
Sub Listbox1_onchange()
'Session("Date") = Listbox1.getText(Listbox1.selectedIndex)
End Sub
</script>
</head>
<body bgcolor="#f6d9ac" text="#ff9900" link="#666666" vlink="#666666" alink="#666666">
<p align="center"><img border="0" src="katalog/katalog/fil.gif"></p>
<p align="center">
<% WriteCounter %>
</p>
<%
dim intYear,intMonth
dim aryYear(12)
dim aryMonth(12)
dim first,last
intYear = Year(Date) ' Current year
intMonth = Month(Date) ' Current month
for i = 0 to 11
aryYear(i) = intYear
aryMonth(i) = intMonth
intMonth = intMonth - 1
if intMonth = 0 then
intYear = intYear - 1
intMonth = 12
end if
next
' Check if Listbox is empty
if Listbox1.getCount()=0 then
for i = 0 to 2
Listbox1.addItem MonthName(aryMonth(i)) & "-" & aryYear(i),cstr(i),i
next
Session("Date") = MonthName(Month(Date)) & "-" & Year(Date)
Listbox1.selectedIndex = 0
end if
intYear = aryYear(Listbox1.selectedIndex) ' Selected Year
intMonth = aryMonth(Listbox1.selectedIndex) ' Selected Month
first = DateSerial(aryYear(Listbox1.selectedIndex), aryMonth(Listbox1.selectedIndex), 1)
last = DateSerial(aryYear(Listbox1.selectedIndex), aryMonth(Listbox1.selectedIndex)+1, 0)
' Get number of dates in month
temp = DateSerial(intYear, intMonth + 1, 0)
DaysInMonth = Day(temp)
WriteListBox
' Write calendar
Response.Write "<p>"
Response.Write "<center>"
Response.Write "<table width=490 border=0>"
Response.Write "<tr>"
for i = 1 to 7
Response.Write "<td bgcolor=#f6d9ac width=70 align=middle height=22><font face=""Arial Narrow"" color=#666666><b>" & DayName(i) & "<b></font></td>"
next
Response.Write "</tr>"
Response.Write "<tr>"
intCol = 1
for i = 1 to Weekday(first,vbMonday)-1
Response.Write "<td width=70> </td>"
intCol = intCol + 1
next
for i = 1 to DaysInMonth
d = intMonth & "/" & i & "/" & intYear
if DateDiff("d",Date,d) <= 0 then
Response.Write "<td bgcolor=#f6d9ac width=70 align=middle height=22><font face=""Arial Narrow"" color=#666666><b><a href=""fil.asp?day=" & d & """>" & i & "</a></b></font></td>"
else
Response.Write "<td bgcolor=#f6d9ac width=70 align=middle height=22><font face=""Arial Narrow"" color=#666666><b>" & i & "</b></font></td>"
end if
intCol = intCol + 1
if intCol = 8 then
Response.Write "</tr>"
Response.Write "<tr>"
intCol = 1
end if
next
Response.Write "</tr>"
Response.Write "</table>"
Response.Write "</center>"
%>
<% sub WriteListBox %>
<center>
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT classid="clsid:B5F0E450-DC5F-11D0-9846-0000F8027CA0" id=Listbox1 style="LEFT: 0px; TOP: 0px" dtcid="1">
<PARAM NAME="_ExtentX" VALUE="2037">
<PARAM NAME="_ExtentY" VALUE="556">
<PARAM NAME="id" VALUE="Listbox1">
<PARAM NAME="DataSource" VALUE="">
<PARAM NAME="DataField" VALUE="">
<PARAM NAME="ControlStyle" VALUE="0">
<PARAM NAME="Enabled" VALUE="-1">
<PARAM NAME="Visible" VALUE="-1">
<PARAM NAME="Platform" VALUE="256">
<PARAM NAME="UsesStaticList" VALUE="0">
<PARAM NAME="RowSource" VALUE="">
<PARAM NAME="BoundColumn" VALUE="">
<PARAM NAME="ListField" VALUE="">
<PARAM NAME="LookupPlatform" VALUE="2">
<PARAM NAME="LocalPath" VALUE=""></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/ListBox.ASP"--><SCRIPT LANGUAGE=JavaScript RUNAT=Server>function _Listbox1_ctor(){ CreateListbox('Listbox1', null, null);}</script><% Listbox1.display %>
<!--METADATA TYPE="DesignerControl" endspan-->
</center>
<% end sub
Function MonthName(intMonth)
Dim strMonth
Select Case intMonth
Case 1
strMonth = "Januari"
Case 2
strMonth = "Februari"
Case 3
strMonth = "Mars"
Case 4
strMonth = "April"
Case 5
strMonth = "Maj"
Case 6
strMonth = "Juni"
Case 7
strMonth = "Juli"
Case 8
strMonth = "Augusti"
Case 9
strMonth = "September"
Case 10
strMonth = "Oktober"
Case 11
strMonth = "November"
Case 12
strMonth = "December"
Case Else
strMonth = "Out of range"
End Select
MonthName = strMonth
End Function
Function DayName(intDay)
Dim strDay
Select Case intDay
Case 1
strDay = "Måndag"
Case 2
strDay = "Tisdag"
Case 3
strDay = "Onsdag"
Case 4
strDay = "Torsdag"
Case 5
strDay = "Fredag"
Case 6
strDay = "Lördag"
Case 7
strDay = "Söndag"
Case Else
strMonth = "Out of range"
End Select
DayName = strDay
End Function
%>
</body>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</form>
</html>
TROR/HOPPAS att jag fått bort det mesta av onödig kod, men dubbelkolla. Skulle göra om lite i scriptet , menhar ej hunnit , vassego.
------------------
/Mvh Annelie( http://www.annelie.nu )