![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| JavaScript JavaScript are you needing help with functions in your script, free help is offered here for all JavaScript problems so if you have an JavaScript error in your code just ask. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Ok. so i have a calendar script that displays the month and days. and it is set up to go to a page when a date is clicked on. what i would like to do, is connect it with a DB so that if there is a tourney on a day... it will show the title of the tourney in the date box. here is the script for the calendar. <!--#include file="connection.asp" --> <% Class Calendar Public Top Public Left Public Width Public Height Public Position Public ZIndex Public TitlebarColor Public TitlebarFont Public TitlebarFontColor Public TodayBGColor Public OnDayClick Public OnNextMonthClick Public OnPrevMonthClick Public ShowDateSelect Private mdDate Private msToday Private mnDay Private mnMonth Private mnYear Private mnDayMonthStarts Private mnDaysInMonth Private mcolDays Private mbDaysInitialized Private Sub Class_Initialize() Top = 0 Left = 0 Width = 500 Height= 500 Position = "absolute" TitlebarColor = "darkblue" TitlebarFont = "arial" TitlebarFontColor = "white" TodayBGColor = "skyblue" ShowDateSelect = True msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()), Day(Now())), 2) zIndex = 1 Set mcolDays = Server.CreateObject("Scripting.Dictionary") If Request("date") <> "" Then SetDate(Request("date")) Else SetDate(Now()) OnDayClick = Request.ServerVariables("SCRIPT_NAME") OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay)) OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay)) mbDaysInitialized = False End Sub Private Sub Class_Terminate() If IsObject(mcolDays) Then mcolDays.RemoveAll Set mcolDays = Nothing End If End Sub Public Property Get GetDate() GetDate = mdDate End Property Public Property Get DaysInMonth() DaysInMonth = mnDaysInMonth End Property Public Property Get WeeksInMonth() If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then WeeksInMonth = 6 Else WeeksInMonth = 5 End If End Property Public Property Get Days(nIndex) If Not mbDaysInitialized Then InitDays() If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex) End Property Private Sub InitDays() Dim nDayIndex Dim objNewDay If mcolDays.Count > 0 Then mcolDays.RemoveAll() For nDayIndex = 1 To mnDaysInMonth Set objNewDay = New CalendarDay objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth, nDayIndex),2) objNewDay.OnClick = OnDayClick mcolDays.Add nDayIndex, objNewDay Next mbDaysInitialized = True End Sub Public Sub SetDate(dDate) mdDate = CDate(dDate) mnDay = Day(dDate) mnMonth = Month(dDate) mnYear = Year(dDate) mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1, 1))) mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1), CDate(dDate))) End Sub Public Sub Draw() Dim nDayCount Dim nCellWidth, nCellHeight, nFontSizeRatio Dim objDay If Not mbDaysInitialized Then InitDays() nCellWidth = CInt(Width / 7) If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then nCellHeight = CInt((Height - 80) / 6) Else nCellHeight = CInt((Height - 80) / 5) End If nFontSizeRatio = Fix(Width / 200) Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " & CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>" Send "<table border=""1"" width=""" & Width & """ height=""" & Height & """ cellspacing=""0"">" Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor & """>" Send " <table border=""0"" width=""100%"" cellspacing=0>" Send " <tr>" Send " <td align=""left""><a style=""text-decoration: none; color: " & TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date", DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" & TitlebarFont & """ size=""" & nFontSizeRatio & """><b> <<</b></font></a></td>" Send " <td align=""center""><font size=""" & nFontSizeRatio & """ face=""" & TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" & MonthName(mnMonth) & " " & mnYear & "</b></font></td>" Send " <td align=""right""><a style=""text-decoration: none; color: " & TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date", DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" & TitlebarFont & """ size=""" & nFontSizeRatio & """><b>>> </b></font></a></td>" Send " </tr>" Send " </table>" Send "</td></tr>" Send "<tr>" Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ align=""center""><small>S</small></td>" Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ align=""center""><small>M</small></td>" Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ align=""center""><small>T</small></td>" Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ align=""center""><small>W</small></td>" Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ align=""center""><small>T</small></td>" Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ align=""center""><small>F</small></td>" Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ align=""center""><small>S</small></td>" Send "</tr>" Send "<tr>" For nDayCount = 1 To mnDayMonthStarts - 1 Send "<td height=""" & CStr(nCellHeight) & """ width=""" & CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" Next nDayCount = nDayCount - 1 For Each objDay In mcolDays.Items If nDayCount = 7 Then Send "</tr><tr>" nDayCount = 0 End If Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" & CStr(nCellWidth) & """ valign=""top"" bgcolor=""" If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send "white"">" objDay.Draw() Send "</td>" nDayCount = nDayCount + 1 Next If nDayCount < 7 Then For nDayCount = nDayCount To 6 Send "<td height=""" & CStr(nCellHeight) & """ width=""" & CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" Next End If Send "</tr>" If ShowDateSelect Then Send "<tr><td height=""30"" colspan=""7"" align=""center"">" DrawDateSelect() Send "</td></tr>" End If Send "</table>" Send "</div>" End Sub Private Sub DrawDateSelect() Dim nIndex Send " <form id=frmGO name=frmGO>" Send " <table border=""0"">" Send " <tr>" Send " <td><select name=""month"">" For nIndex = 1 To 12 Response.Write "<option value=""" & nIndex & """" If nIndex = Month(mdDate) Then Response.Write " selected" Send ">" & MonthName(nIndex, True) & "</option>" Next Send " </select></td>" Send " <td><select name=""year"">" For nIndex = Year(Now()) - 4 To Year(Now()) + 6 Response.Write "<option value=""" & nIndex & """" If nIndex = Year(mdDate) Then Response.Write " selected" Send ">" & CStr(nIndex) & "</option>" Next Send " </select></td>" Send " <td><input type=""button"" Value=""Go"" onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") & "?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;"" id=1 name=1></td>" Send " </form>" Send " </tr></table>" End Sub Private Sub Send(sHTML) Response.Write sHTML & vbCrLf End Sub End Class Class CalendarDay Public DateString Public OnClick Private mcolActivities Private mbActivitiesInit Private Sub Class_Initialize() mbActivitiesInit = False End Sub Private Sub Class_Terminate() If IsObject(mcolActivities) Then mcolActivities.RemoveAll() Set mcolActivities = Nothing End If End Sub Private Sub InitActivities() Set mcolActivities = Server.CreateObject("Scripting.Dictionary") mbActivitiesInit = True End Sub Public Sub AddActivity(sActivity, sColor) If Not mbActivitiesInit Then InitActivities() mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor & """>" & sActivity End Sub Public Sub Draw() Dim objActivity Send "<table width=""100%"" border=""0"" cellspacing=""2"" cellpadding=""1"">" Send "<tr><td align=""left"" valign=""top""><a href=""" & Replace(OnClick, "$date", DateString) & """><small>" & Day(DateString) & "</small></a></td></tr>" If mbActivitiesInit Then For Each objActivity In mcolActivities.Items Send "<tr><td height=""20""" & objActivity & "</td></tr>" Next End If Send "</table>" End Sub Private Sub Send(sHTML) Response.Write sHTML & vbCrLf End Sub End Class %> lots of lines.... but that is the code. now i have connected to the DB as you can see. the iheader field contains the title that i want. so somewhere i need a line that checks the date against the DB, and if true then display the title. can anyone help me here?? thanks Jeff | |||
| Advertisements |
| | #2 | ||
| "Jeff" <gig_bam@adelphia.net> wrote in message news:a_adnVRvbZsjw4rZRVn-iw@adelphia.com... > Ok. so i have a calendar script that displays the month and days. and it > is set up to go to a page when a date is clicked on. > > what i would like to do, is connect it with a DB so that if there is a > tourney on a day... it will show the title of the tourney in the date box. > here is the script for the calendar. > > > <!--#include file="connection.asp" --> > <% > > Class Calendar > Public Top > Public Left > Public Width > Public Height > Public Position > Public ZIndex > Public TitlebarColor > Public TitlebarFont > Public TitlebarFontColor > Public TodayBGColor > Public OnDayClick > Public OnNextMonthClick > Public OnPrevMonthClick > Public ShowDateSelect > Private mdDate > Private msToday > Private mnDay > Private mnMonth > Private mnYear > Private mnDayMonthStarts > Private mnDaysInMonth > Private mcolDays > Private mbDaysInitialized > > Private Sub Class_Initialize() > Top = 0 > Left = 0 > Width = 500 > Height= 500 > Position = "absolute" > TitlebarColor = "darkblue" > TitlebarFont = "arial" > TitlebarFontColor = "white" > TodayBGColor = "skyblue" > ShowDateSelect = True > msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()), > Day(Now())), 2) > zIndex = 1 > > Set mcolDays = Server.CreateObject("Scripting.Dictionary") > If Request("date") <> "" Then SetDate(Request("date")) Else > SetDate(Now()) > > OnDayClick = Request.ServerVariables("SCRIPT_NAME") > OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & > Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay)) > OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & > Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay)) > > mbDaysInitialized = False > End Sub > > Private Sub Class_Terminate() > If IsObject(mcolDays) Then > mcolDays.RemoveAll > Set mcolDays = Nothing > End If > End Sub > > Public Property Get GetDate() > GetDate = mdDate > End Property > > Public Property Get DaysInMonth() > DaysInMonth = mnDaysInMonth > End Property > > Public Property Get WeeksInMonth() > If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then > WeeksInMonth = 6 > Else > WeeksInMonth = 5 > End If > End Property > > Public Property Get Days(nIndex) > If Not mbDaysInitialized Then InitDays() > If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex) > End Property > > Private Sub InitDays() > Dim nDayIndex > Dim objNewDay > > If mcolDays.Count > 0 Then mcolDays.RemoveAll() > > For nDayIndex = 1 To mnDaysInMonth > Set objNewDay = New CalendarDay > objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth, > nDayIndex),2) > objNewDay.OnClick = OnDayClick > > mcolDays.Add nDayIndex, objNewDay > Next > > mbDaysInitialized = True > End Sub > > Public Sub SetDate(dDate) > mdDate = CDate(dDate) > mnDay = Day(dDate) > mnMonth = Month(dDate) > mnYear = Year(dDate) > > mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1, > 1))) > mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1), > CDate(dDate))) > End Sub > > Public Sub Draw() > Dim nDayCount > Dim nCellWidth, nCellHeight, nFontSizeRatio > Dim objDay > > If Not mbDaysInitialized Then InitDays() > > nCellWidth = CInt(Width / 7) > If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then > nCellHeight = CInt((Height - 80) / 6) > Else > nCellHeight = CInt((Height - 80) / 5) > End If > > nFontSizeRatio = Fix(Width / 200) > > Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " & > CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>" > Send "<table border=""1"" width=""" & Width & """ height=""" & Height & > """ cellspacing=""0"">" > Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor & > """>" > Send " <table border=""0"" width=""100%"" cellspacing=0>" > Send " <tr>" > Send " <td align=""left""><a style=""text-decoration: none; color: " & > TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date", > DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" & > TitlebarFont & """ size=""" & nFontSizeRatio & > """><b> <<</b></font></a></td>" > Send " <td align=""center""><font size=""" & nFontSizeRatio & """ > face=""" & TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" & > MonthName(mnMonth) & " " & mnYear & "</b></font></td>" > Send " <td align=""right""><a style=""text-decoration: none; color: " & > TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date", > DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" & > TitlebarFont & """ size=""" & nFontSizeRatio & > """><b>>> </b></font></a></td>" > Send " </tr>" > Send " </table>" > Send "</td></tr>" > Send "<tr>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>S</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>M</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>T</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>W</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>T</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>F</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>S</small></td>" > Send "</tr>" > > Send "<tr>" > For nDayCount = 1 To mnDayMonthStarts - 1 > Send "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" > Next > > nDayCount = nDayCount - 1 > > For Each objDay In mcolDays.Items > > If nDayCount = 7 Then > Send "</tr><tr>" > nDayCount = 0 > End If > > Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ valign=""top"" bgcolor=""" > If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send > "white"">" > > objDay.Draw() > Send "</td>" > > nDayCount = nDayCount + 1 > Next > > If nDayCount < 7 Then > For nDayCount = nDayCount To 6 > Send "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" > Next > End If > > Send "</tr>" > > If ShowDateSelect Then > Send "<tr><td height=""30"" colspan=""7"" align=""center"">" > DrawDateSelect() > Send "</td></tr>" > End If > > Send "</table>" > Send "</div>" > End Sub > > Private Sub DrawDateSelect() > Dim nIndex > Send " <form id=frmGO name=frmGO>" > Send " <table border=""0"">" > Send " <tr>" > Send " <td><select name=""month"">" > For nIndex = 1 To 12 > Response.Write "<option value=""" & nIndex & """" > If nIndex = Month(mdDate) Then Response.Write " selected" > Send ">" & MonthName(nIndex, True) & "</option>" > Next > Send " </select></td>" > Send " <td><select name=""year"">" > For nIndex = Year(Now()) - 4 To Year(Now()) + 6 > Response.Write "<option value=""" & nIndex & """" > If nIndex = Year(mdDate) Then Response.Write " selected" > Send ">" & CStr(nIndex) & "</option>" > Next > Send " </select></td>" > Send " <td><input type=""button"" Value=""Go"" > onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") & > "?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;"" > id=1 name=1></td>" > Send " </form>" > Send " </tr></table>" > End Sub > > Private Sub Send(sHTML) > Response.Write sHTML & vbCrLf > End Sub > > End Class > > > Class CalendarDay > Public DateString > Public OnClick > Private mcolActivities > Private mbActivitiesInit > > Private Sub Class_Initialize() > mbActivitiesInit = False > End Sub > > Private Sub Class_Terminate() > If IsObject(mcolActivities) Then > mcolActivities.RemoveAll() > Set mcolActivities = Nothing > End If > End Sub > > Private Sub InitActivities() > Set mcolActivities = Server.CreateObject("Scripting.Dictionary") > mbActivitiesInit = True > End Sub > > Public Sub AddActivity(sActivity, sColor) > If Not mbActivitiesInit Then InitActivities() > mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor & > """>" & sActivity > End Sub > > Public Sub Draw() > Dim objActivity > > Send "<table width=""100%"" border=""0"" cellspacing=""2"" > cellpadding=""1"">" > Send "<tr><td align=""left"" valign=""top""><a href=""" & > Replace(OnClick, "$date", DateString) & """><small>" & Day(DateString) & > "</small></a></td></tr>" > If mbActivitiesInit Then > For Each objActivity In mcolActivities.Items > Send "<tr><td height=""20""" & objActivity & "</td></tr>" > Next > End If > Send "</table>" > End Sub > > Private Sub Send(sHTML) > Response.Write sHTML & vbCrLf > End Sub > End Class > > > %> > > lots of lines.... but that is the code. > > now i have connected to the DB as you can see. > > the iheader field contains the title that i want. so somewhere i need a > line that checks the date against the DB, and if true then display the > title. > > can anyone help me here?? > > thanks > Jeff > let me add the actual output/display page for the calendar <% Dim MyCalendar ' Create the calendar Set MyCalendar = New Calendar ' Set the visual properties MyCalendar.Top = 0 'Sets the top position MyCalendar.Left = 0 'Sets the left position MyCalendar.Position = "center" 'Relative or Absolute positioning MyCalendar.Height = "600" 'Sets the height MyCalendar.Width = "600" 'Sets the width MyCalendar.TitlebarColor = "darkblue" 'Sets the color of the titlebar MyCalendar.TitlebarFont = "arial" 'Sets the font face of the titlebar MyCalendar.TitlebarFontColor = "white" 'Sets the font color of the titlebar MyCalendar.TodayBGColor = "skyblue" 'Sets the highlight color of the current day MyCalendar.ShowDateSelect = True 'Toggles the Date Selection form. ' Add event code for when a day is clicked on. Notice ' that when run inside your browser, "$date" is replaced ' by the date you click on. MyCalendar.OnDayClick = "calendar2.asp?d=$date" ' Draw the calendar to the browser MyCalendar.Draw() %> | |||
| | #3 | ||
| dang.... and the date is in the field idate "Jeff" <gig_bam@adelphia.net> wrote in message news:a_adnVRvbZsjw4rZRVn-iw@adelphia.com... > Ok. so i have a calendar script that displays the month and days. and it > is set up to go to a page when a date is clicked on. > > what i would like to do, is connect it with a DB so that if there is a > tourney on a day... it will show the title of the tourney in the date box. > here is the script for the calendar. > > > <!--#include file="connection.asp" --> > <% > > Class Calendar > Public Top > Public Left > Public Width > Public Height > Public Position > Public ZIndex > Public TitlebarColor > Public TitlebarFont > Public TitlebarFontColor > Public TodayBGColor > Public OnDayClick > Public OnNextMonthClick > Public OnPrevMonthClick > Public ShowDateSelect > Private mdDate > Private msToday > Private mnDay > Private mnMonth > Private mnYear > Private mnDayMonthStarts > Private mnDaysInMonth > Private mcolDays > Private mbDaysInitialized > > Private Sub Class_Initialize() > Top = 0 > Left = 0 > Width = 500 > Height= 500 > Position = "absolute" > TitlebarColor = "darkblue" > TitlebarFont = "arial" > TitlebarFontColor = "white" > TodayBGColor = "skyblue" > ShowDateSelect = True > msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()), > Day(Now())), 2) > zIndex = 1 > > Set mcolDays = Server.CreateObject("Scripting.Dictionary") > If Request("date") <> "" Then SetDate(Request("date")) Else > SetDate(Now()) > > OnDayClick = Request.ServerVariables("SCRIPT_NAME") > OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & > Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay)) > OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & > Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay)) > > mbDaysInitialized = False > End Sub > > Private Sub Class_Terminate() > If IsObject(mcolDays) Then > mcolDays.RemoveAll > Set mcolDays = Nothing > End If > End Sub > > Public Property Get GetDate() > GetDate = mdDate > End Property > > Public Property Get DaysInMonth() > DaysInMonth = mnDaysInMonth > End Property > > Public Property Get WeeksInMonth() > If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then > WeeksInMonth = 6 > Else > WeeksInMonth = 5 > End If > End Property > > Public Property Get Days(nIndex) > If Not mbDaysInitialized Then InitDays() > If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex) > End Property > > Private Sub InitDays() > Dim nDayIndex > Dim objNewDay > > If mcolDays.Count > 0 Then mcolDays.RemoveAll() > > For nDayIndex = 1 To mnDaysInMonth > Set objNewDay = New CalendarDay > objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth, > nDayIndex),2) > objNewDay.OnClick = OnDayClick > > mcolDays.Add nDayIndex, objNewDay > Next > > mbDaysInitialized = True > End Sub > > Public Sub SetDate(dDate) > mdDate = CDate(dDate) > mnDay = Day(dDate) > mnMonth = Month(dDate) > mnYear = Year(dDate) > > mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1, > 1))) > mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1), > CDate(dDate))) > End Sub > > Public Sub Draw() > Dim nDayCount > Dim nCellWidth, nCellHeight, nFontSizeRatio > Dim objDay > > If Not mbDaysInitialized Then InitDays() > > nCellWidth = CInt(Width / 7) > If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then > nCellHeight = CInt((Height - 80) / 6) > Else > nCellHeight = CInt((Height - 80) / 5) > End If > > nFontSizeRatio = Fix(Width / 200) > > Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " & > CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>" > Send "<table border=""1"" width=""" & Width & """ height=""" & Height & > """ cellspacing=""0"">" > Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor & > """>" > Send " <table border=""0"" width=""100%"" cellspacing=0>" > Send " <tr>" > Send " <td align=""left""><a style=""text-decoration: none; color: " & > TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date", > DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" & > TitlebarFont & """ size=""" & nFontSizeRatio & > """><b> <<</b></font></a></td>" > Send " <td align=""center""><font size=""" & nFontSizeRatio & """ > face=""" & TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" & > MonthName(mnMonth) & " " & mnYear & "</b></font></td>" > Send " <td align=""right""><a style=""text-decoration: none; color: " & > TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date", > DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" & > TitlebarFont & """ size=""" & nFontSizeRatio & > """><b>>> </b></font></a></td>" > Send " </tr>" > Send " </table>" > Send "</td></tr>" > Send "<tr>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>S</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>M</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>T</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>W</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>T</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>F</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>S</small></td>" > Send "</tr>" > > Send "<tr>" > For nDayCount = 1 To mnDayMonthStarts - 1 > Send "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" > Next > > nDayCount = nDayCount - 1 > > For Each objDay In mcolDays.Items > > If nDayCount = 7 Then > Send "</tr><tr>" > nDayCount = 0 > End If > > Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ valign=""top"" bgcolor=""" > If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send > "white"">" > > objDay.Draw() > Send "</td>" > > nDayCount = nDayCount + 1 > Next > > If nDayCount < 7 Then > For nDayCount = nDayCount To 6 > Send "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" > Next > End If > > Send "</tr>" > > If ShowDateSelect Then > Send "<tr><td height=""30"" colspan=""7"" align=""center"">" > DrawDateSelect() > Send "</td></tr>" > End If > > Send "</table>" > Send "</div>" > End Sub > > Private Sub DrawDateSelect() > Dim nIndex > Send " <form id=frmGO name=frmGO>" > Send " <table border=""0"">" > Send " <tr>" > Send " <td><select name=""month"">" > For nIndex = 1 To 12 > Response.Write "<option value=""" & nIndex & """" > If nIndex = Month(mdDate) Then Response.Write " selected" > Send ">" & MonthName(nIndex, True) & "</option>" > Next > Send " </select></td>" > Send " <td><select name=""year"">" > For nIndex = Year(Now()) - 4 To Year(Now()) + 6 > Response.Write "<option value=""" & nIndex & """" > If nIndex = Year(mdDate) Then Response.Write " selected" > Send ">" & CStr(nIndex) & "</option>" > Next > Send " </select></td>" > Send " <td><input type=""button"" Value=""Go"" > onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") & > "?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;"" > id=1 name=1></td>" > Send " </form>" > Send " </tr></table>" > End Sub > > Private Sub Send(sHTML) > Response.Write sHTML & vbCrLf > End Sub > > End Class > > > Class CalendarDay > Public DateString > Public OnClick > Private mcolActivities > Private mbActivitiesInit > > Private Sub Class_Initialize() > mbActivitiesInit = False > End Sub > > Private Sub Class_Terminate() > If IsObject(mcolActivities) Then > mcolActivities.RemoveAll() > Set mcolActivities = Nothing > End If > End Sub > > Private Sub InitActivities() > Set mcolActivities = Server.CreateObject("Scripting.Dictionary") > mbActivitiesInit = True > End Sub > > Public Sub AddActivity(sActivity, sColor) > If Not mbActivitiesInit Then InitActivities() > mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor & > """>" & sActivity > End Sub > > Public Sub Draw() > Dim objActivity > > Send "<table width=""100%"" border=""0"" cellspacing=""2"" > cellpadding=""1"">" > Send "<tr><td align=""left"" valign=""top""><a href=""" & > Replace(OnClick, "$date", DateString) & """><small>" & Day(DateString) & > "</small></a></td></tr>" > If mbActivitiesInit Then > For Each objActivity In mcolActivities.Items > Send "<tr><td height=""20""" & objActivity & "</td></tr>" > Next > End If > Send "</table>" > End Sub > > Private Sub Send(sHTML) > Response.Write sHTML & vbCrLf > End Sub > End Class > > > %> > > lots of lines.... but that is the code. > > now i have connected to the DB as you can see. > > the iheader field contains the title that i want. so somewhere i need a > line that checks the date against the DB, and if true then display the > title. > > can anyone help me here?? > > thanks > Jeff > | |||
| | #4 | ||
| does this mean that this was the wrong place to post this ??? "Jeff" <gig_bam@adelphia.net> wrote in message news:a_adnVRvbZsjw4rZRVn-iw@adelphia.com... > Ok. so i have a calendar script that displays the month and days. and it > is set up to go to a page when a date is clicked on. > > what i would like to do, is connect it with a DB so that if there is a > tourney on a day... it will show the title of the tourney in the date box. > here is the script for the calendar. > > > <!--#include file="connection.asp" --> > <% > > Class Calendar > Public Top > Public Left > Public Width > Public Height > Public Position > Public ZIndex > Public TitlebarColor > Public TitlebarFont > Public TitlebarFontColor > Public TodayBGColor > Public OnDayClick > Public OnNextMonthClick > Public OnPrevMonthClick > Public ShowDateSelect > Private mdDate > Private msToday > Private mnDay > Private mnMonth > Private mnYear > Private mnDayMonthStarts > Private mnDaysInMonth > Private mcolDays > Private mbDaysInitialized > > Private Sub Class_Initialize() > Top = 0 > Left = 0 > Width = 500 > Height= 500 > Position = "absolute" > TitlebarColor = "darkblue" > TitlebarFont = "arial" > TitlebarFontColor = "white" > TodayBGColor = "skyblue" > ShowDateSelect = True > msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()), > Day(Now())), 2) > zIndex = 1 > > Set mcolDays = Server.CreateObject("Scripting.Dictionary") > If Request("date") <> "" Then SetDate(Request("date")) Else > SetDate(Now()) > > OnDayClick = Request.ServerVariables("SCRIPT_NAME") > OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & > Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay)) > OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" & > Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay)) > > mbDaysInitialized = False > End Sub > > Private Sub Class_Terminate() > If IsObject(mcolDays) Then > mcolDays.RemoveAll > Set mcolDays = Nothing > End If > End Sub > > Public Property Get GetDate() > GetDate = mdDate > End Property > > Public Property Get DaysInMonth() > DaysInMonth = mnDaysInMonth > End Property > > Public Property Get WeeksInMonth() > If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then > WeeksInMonth = 6 > Else > WeeksInMonth = 5 > End If > End Property > > Public Property Get Days(nIndex) > If Not mbDaysInitialized Then InitDays() > If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex) > End Property > > Private Sub InitDays() > Dim nDayIndex > Dim objNewDay > > If mcolDays.Count > 0 Then mcolDays.RemoveAll() > > For nDayIndex = 1 To mnDaysInMonth > Set objNewDay = New CalendarDay > objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth, > nDayIndex),2) > objNewDay.OnClick = OnDayClick > > mcolDays.Add nDayIndex, objNewDay > Next > > mbDaysInitialized = True > End Sub > > Public Sub SetDate(dDate) > mdDate = CDate(dDate) > mnDay = Day(dDate) > mnMonth = Month(dDate) > mnYear = Year(dDate) > > mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1, > 1))) > mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1), > CDate(dDate))) > End Sub > > Public Sub Draw() > Dim nDayCount > Dim nCellWidth, nCellHeight, nFontSizeRatio > Dim objDay > > If Not mbDaysInitialized Then InitDays() > > nCellWidth = CInt(Width / 7) > If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then > nCellHeight = CInt((Height - 80) / 6) > Else > nCellHeight = CInt((Height - 80) / 5) > End If > > nFontSizeRatio = Fix(Width / 200) > > Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " & > CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>" > Send "<table border=""1"" width=""" & Width & """ height=""" & Height & > """ cellspacing=""0"">" > Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor & > """>" > Send " <table border=""0"" width=""100%"" cellspacing=0>" > Send " <tr>" > Send " <td align=""left""><a style=""text-decoration: none; color: " & > TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date", > DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" & > TitlebarFont & """ size=""" & nFontSizeRatio & > """><b> <<</b></font></a></td>" > Send " <td align=""center""><font size=""" & nFontSizeRatio & """ > face=""" & TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" & > MonthName(mnMonth) & " " & mnYear & "</b></font></td>" > Send " <td align=""right""><a style=""text-decoration: none; color: " & > TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date", > DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" & > TitlebarFont & """ size=""" & nFontSizeRatio & > """><b>>> </b></font></a></td>" > Send " </tr>" > Send " </table>" > Send "</td></tr>" > Send "<tr>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>S</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>M</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>T</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>W</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>T</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>F</small></td>" > Send "<td height=""20"" width=""" & CStr(nCellWidth) & """ > align=""center""><small>S</small></td>" > Send "</tr>" > > Send "<tr>" > For nDayCount = 1 To mnDayMonthStarts - 1 > Send "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" > Next > > nDayCount = nDayCount - 1 > > For Each objDay In mcolDays.Items > > If nDayCount = 7 Then > Send "</tr><tr>" > nDayCount = 0 > End If > > Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ valign=""top"" bgcolor=""" > If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send > "white"">" > > objDay.Draw() > Send "</td>" > > nDayCount = nDayCount + 1 > Next > > If nDayCount < 7 Then > For nDayCount = nDayCount To 6 > Send "<td height=""" & CStr(nCellHeight) & """ width=""" & > CStr(nCellWidth) & """ bgcolor=""#dddddd""> </td>" > Next > End If > > Send "</tr>" > > If ShowDateSelect Then > Send "<tr><td height=""30"" colspan=""7"" align=""center"">" > DrawDateSelect() > Send "</td></tr>" > End If > > Send "</table>" > Send "</div>" > End Sub > > Private Sub DrawDateSelect() > Dim nIndex > Send " <form id=frmGO name=frmGO>" > Send " <table border=""0"">" > Send " <tr>" > Send " <td><select name=""month"">" > For nIndex = 1 To 12 > Response.Write "<option value=""" & nIndex & """" > If nIndex = Month(mdDate) Then Response.Write " selected" > Send ">" & MonthName(nIndex, True) & "</option>" > Next > Send " </select></td>" > Send " <td><select name=""year"">" > For nIndex = Year(Now()) - 4 To Year(Now()) + 6 > Response.Write "<option value=""" & nIndex & """" > If nIndex = Year(mdDate) Then Response.Write " selected" > Send ">" & CStr(nIndex) & "</option>" > Next > Send " </select></td>" > Send " <td><input type=""button"" Value=""Go"" > onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") & > "?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;"" > id=1 name=1></td>" > Send " </form>" > Send " </tr></table>" > End Sub > > Private Sub Send(sHTML) > Response.Write sHTML & vbCrLf > End Sub > > End Class > > > Class CalendarDay > Public DateString > Public OnClick > Private mcolActivities > Private mbActivitiesInit > > Private Sub Class_Initialize() > mbActivitiesInit = False > End Sub > > Private Sub Class_Terminate() > If IsObject(mcolActivities) Then > mcolActivities.RemoveAll() > Set mcolActivities = Nothing > End If > End Sub > > Private Sub InitActivities() > Set mcolActivities = Server.CreateObject("Scripting.Dictionary") > mbActivitiesInit = True > End Sub > > Public Sub AddActivity(sActivity, sColor) > If Not mbActivitiesInit Then InitActivities() > mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor & > """>" & sActivity > End Sub > > Public Sub Draw() > Dim objActivity > > Send "<table width=""100%"" border=""0"" cellspacing=""2"" > cellpadding=""1"">" > Send "<tr><td align=""left"" valign=""top""><a href=""" & > Replace(OnClick, "$date", DateString) & """><small>" & Day(DateString) & > "</small></a></td></tr>" > If mbActivitiesInit Then > For Each objActivity In mcolActivities.Items > Send "<tr><td height=""20""" & objActivity & "</td></tr>" > Next > End If > Send "</table>" > End Sub > > Private Sub Send(sHTML) > Response.Write sHTML & vbCrLf > End Sub > End Class > > > %> > > lots of lines.... but that is the code. > > now i have connected to the DB as you can see. > > the iheader field contains the title that i want. so somewhere i need a > line that checks the date against the DB, and if true then display the > title. > > can anyone help me here?? > > thanks > Jeff > | |||
| Featured Websites | ||||
|
![]() |
| Tags: calendar |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calendar (with a CSS layout) | ©® | CSS | 3 | 07-01-2007 2:16 PM |
| Calendar Using CSS Layout | Joe Follansbee | HTML | 1 | 07-01-2007 1:42 PM |
| Calendar Using CSS Layout | Jacqui or (maybe) Pete | HTML | 0 | 07-01-2007 1:27 PM |
| Calendar Notification Bug? | danielgazineu@gmail.com | Google questions | 0 | 05-28-2007 1:45 AM |
| Featured Websites | ||||
|