The Option method generates an OPTION item in an HTML form selection list, and assigns it the value and selection state that you specify.
Page.Option(Value, State)
The following example generates a selection field in an HTML form to enable the customer to select the expiration year of the credit card. The Option method generates <OPTION VALUE=">
tags and marks the current year as selected:
iyear = Year(date) %>
<SELECT NAME="_cc_expyear">
<% = mscsPage.Option(1997, iyear) %> 1997
<% = mscsPage.Option(1998, iyear) %> 1998
<% = mscsPage.Option(1999, iyear) %> 1999
<% = mscsPage.Option(2000, iyear) %> 2000
<% = mscsPage.Option(2001, iyear) %> 2001
<% = mscsPage.Option(2002, iyear) %> 2002
<% = mscsPage.Option(2003, iyear) %> 2003
</SELECT>
Following is the HTML output that is produced by the ASP script shown previously, assuming that the current year is 1998:
<SELECT NAME="_cc_expyear">
<OPTION VALUE="1997"> 1997
<OPTION VALUE="1998" SELECTED> 1998
<OPTION VALUE="1999"> 1999
<OPTION VALUE="2000"> 2000
<OPTION VALUE="2001"> 2001
<OPTION VALUE="2002"> 2002
<OPTION VALUE="2003"> 2003
</SELECT>