|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
dropdown box select date (HELP!)
Hello peeps,
My code doesnt work. using vb script not javascript, I need to determine the exact number of days in a given month . I dont know how to get the value of the control variable for the server side. I think the problem is in the onchange event of dropdown box. So please help me... Below is my code.. any help is highly appreciated. <%@ LANGUAGE = VBScript %> <!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common Files\system\ado\msado15.dll" --> <% Option Explicit Dim YearToday Dim intYear YearToday = year(now()) Dim ChosenMonth Dim ChosenYear %> <html> <head> <META name=VI60_defaultClientScript content=VBScript> <title>Date</title></head> <hr width = 500 align=left /> <br> <!--<body onLoad = "document.form1"> --> <body onload = "document.form1, document.form1.lstYear.value = <%=year(now()) %>, document.form1.lstMonth.value = <%=month(now())%>, document.form1.lstDay.value = <%=Day(now())%>" > <form action = "Gettable.asp" name=form1 method= "post"> <% Function NumberOfDays(iMonth,iYear) Select Case iMonth Case 4, 6, 9, 11 NumberOfDays = 30 Case 2 If IsDate("February 29, " & iYear) Then NumberOfDays = 29 Else NumberOfDays = 28 End If Case 1,3,5,7,8,10,12 NumberOfDays = 31 End Select End Function %> <SELECT id=lstYear name=lstYear onChange='intChosenYear=this.options[this.selectedIndex].value'> <% 'intChosenYear = Request.Item ("lstYear") Dim n for n = 0 to 5 intyear = YearToday - n response.write("<option value='" & intYear & "'>" & intYear & "</option>") next %> </SELECT> <SELECT id=lstmonth name=lstMonth onChange='intChosenMonth=this.options[this.selectedIndex].value'> <% Dim intMonth intMonth = 1 for n = 1 to 12 response.write("<option value='" & intMonth & "'>" & intMonth & "</option><br>") intMonth = intMonth + 1 next %> </SELECT> <SELECT id=lstDay name=lstDay> <% Dim intDay chosenYear =Request.Item("intChoseMonth") chosenMonth = Request.Item("intChoseMonth") For intDay = 1 To NumberOfDays(ChosenMonth,ChosenYear) response.write("<option value='" & intDay & "'>" & intDay & "</option><br>") Next %> </SELECT> <input type ="Submit" value = "ShowRecord" id=Submit1 name=Submit1> </form> </body> </html> |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > dropdown box select date (HELP!) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|