tja! Mitt förslag:Lista år year(now()) till och med 1900 i dropdownmeny.
Vill lista ett par årtal i en dropdown-lista. Hittade en bra kod för detta men den börjar med 1900 och jag vill börja med 2002 alltså year(now()).
Hur gör jag detta.
Här är koden:
<%
' SETUP VARIABLES
myStartYear = 1900 ' YEAR To START COUNT FROM
myYearToday = year(now()) ' THIS YEAR CALCULATED
respyear = myStartYear ' SETTING EQUAL To TEMP VARIABLE SO WE DON'T TRASH OUR STARTING VALUE
' CALCULATE THE DIFFERENCE IN YEARS AND
' SET TO A TEMP VARIABLE
yearDiff = int(myYearToday) - myStartYear
response.write "<Select name='myYear'>"
response.write "<OPTION value='0' selected>alla år</OPTION>"
For i=0 To yearDiff
response.write "<OPTION value='"&respYear&"'>"&respYear&"</OPTION>"
respYear = respYear + 1
next
response.write "</Select>"
%>Sv: Lista år year(now()) till och med 1900 i dropdownmeny.
<code>
<%
Dim lngYear
' SETUP VARIABLES
myStartYear = 1900 ' YEAR To START COUNT FROM
myYearToday = year(now()) ' THIS YEAR CALCULATED
response.write "<Select name='myYear'>"
response.write "<OPTION value='0' selected>alla år</OPTION>"
For lngYear = myStartYear To myYearToday
Response.write "<OPTION value='" & lngYear & "'>"& lngYear & "</OPTION>"
Next
response.write "</Select>"
%>