Year math for creating SELECT options

# Thread: Year math for creating SELECT options

1. Senior Member
Join Date
Dec 1969
Posts
1,013

## Year math for creating SELECT options

I want to create a SELECT combobox with 3 possible choices:<BR><BR>current year, next year, and 2 years out. Something like:<BR><BR>SelYear1 = YEAR(DATE())<BR>SelYear2 = YEAR(DATE())+1<BR>SelYear3 = YEAR(DATE())+2<BR><BR>&#060;select name="selyear"&#062;<BR>&#060;option&#062;&SelYear 1<BR>&#060;option&#062;&SelYear2<BR>&#060;option&# 062;&SelYear3<BR><BR>How do i do this in javascript/vbscript?

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## ?? You just did it??

&#060;%<BR>...<BR>SelYear1 = YEAR(DATE())<BR>SelYear2 = YEAR(DATE())+1<BR>SelYear3 = YEAR(DATE())+2<BR>...<BR>%&#062;<BR><BR>&#060;sele ct name="selyear"&#062;<BR>&#060;option&#062;&#060;% = SelYear1 %&#062;<BR>&#060;option&#062;&#060;% = SelYear2 %&#062;<BR>&#060;option&#062;&#060;% = SelYear3 %&#062;<BR>&#060;/select&#062;<BR><BR>...<BR><BR>The only thing you screwed up was the basic syntax of going in and out of ASP vs. HTML. If you are having troubles with that, time to go back and re-read the first couple of chapters of your ASP book. You need to get that firmly in your mind before you proceed.<BR><BR>By the way...what does this have to do with "databases", the nominal title of this forum? (HINT: Better to ask this in the standard ASP forum.)<BR><BR><BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•