Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Dictionary Objects
     [next Lesson]  Subroutine: Working with Dates #2

Subroutines - Choosing/Validating Dates by Charles Carroll

Subroutines can be used to provide handy date entry list boxes.

   filename=/learn/test/subdates.asp

<Test Script Below>


<HEAD><TITLE>subdates.asp</TITLE></HEAD>
<HTML><body bgcolor="#FFFFFF">
<form action="subdatesrespond.asp">
Depart:
<%call showdateform("depart")%>
<br>
Arrive:
<%call showdateform("arrive")%>
<input type="submit" value="Ready To Travel">
</form>
<%
sub showdateform(mylistname)
    call showmonth(mylistname)
    call showday(mylistname)
    call showyear(mylistname)
end sub
%>

<%sub showmonth(listname)%>
    <select name="<%=listname%>month">
    <%
    dim monthname
    monthname=array("Jan","feb","Mar","Apr", _
            "May","Jun","Jul","Aug", _
            "Sep","Oct","Nov","Dec")
    for counter=0 to 11    
        temp=monthname(counter)
        response.write "<option value='" & counter+1 
        response.write "'>" & temp & "</option>"        
    next%>
    </select>
<%end sub%>

<%sub showday(listname)%>
    <select name="<%=listname%>day">
    <%for counter=1 to 31
        response.write "<option>" & counter & "</option>"        
    next%>
    </select>
<%end sub%>

<%sub showyear(listname)%>
    <select name="<%=listname%>year">
    <%for counter=1964 to 2005
        response.write "<option>" & counter & "</option>"        
    next%>
    </select>
<%end sub%>


</BODY></HTML>

There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.