Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 22nd, 2005, 08:42 AM
tonibibaks tonibibaks is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 1 tonibibaks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 35 sec
Reputation Power: 0
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>

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > dropdown box select date (HELP!)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway