Hi,
First of all you need to register MSCAL.OCX in Windows on all clients accessing your site. The file comes with 3 other files(MSCAL.DEP; MSCAL.CNT; MSCAL.HLP). I think it should work stand alone as well. If you use the next ASP/VBSript code it should work.
Advantage: Control is nice and very MS aplications like.
Disadvantage: Works on IE only and you must register MSCAL.OCX.
How to register:
Save MSCAL.OCX in c:\windows\system32(if your windows folder is named windows)
Open a command prompt and type, followed by enter:
regsvr32.exe c:\windows\system32\mscal.ocx
What does the code do:
Variable 'browser' is filled with a textstring containing information on what browser you use.
If the string contains "MSIE" then you use internet explorer and the Active-X control is used, the current date is already picked (the user can't select invalid dates like for example: 2/31/2001)
If another browser is used it creates 3 dropdowns to select a date in a more conventional way(you have to check afterwards if a valid date is selected, also you have to format the 3 values into a date). Good luck.
Louie66
<% browser = Request.ServerVariables("HTTP_USER_AGENT"

%>
<% If Instr(browser, "MSIE"

<> 0 then %>
<OBJECT classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" id=SelectedDate name=SelectedDate style="LEFT: 0px; TOP: 0px">
<PARAM NAME="_Version" VALUE="524288">
<PARAM NAME="_ExtentX" VALUE="7620">
<PARAM NAME="_ExtentY" VALUE="5080">
<PARAM NAME="_StockProps" VALUE="1">
<PARAM NAME="BackColor" VALUE="-2147483633">
<PARAM NAME="Year" VALUE="<%= year(NOW()) %>">
<PARAM NAME="Month" VALUE="<%= month(NOW()) %>">
<PARAM NAME="Day" VALUE="<%= day(NOW()) %>">
<PARAM NAME="DayLength" VALUE="1">
<PARAM NAME="MonthLength" VALUE="2">
<PARAM NAME="DayFontColor" VALUE="0">
<PARAM NAME="FirstDay" VALUE="1">
<PARAM NAME="GridCellEffect" VALUE="1">
<PARAM NAME="GridFontColor" VALUE="10485760">
<PARAM NAME="GridLinesColor" VALUE="-2147483632">
<PARAM NAME="ShowDateSelectors" VALUE="-1">
<PARAM NAME="ShowDays" VALUE="-1">
<PARAM NAME="ShowHorizontalGrid" VALUE="-1">
<PARAM NAME="ShowTitle" VALUE="-1">
<PARAM NAME="ShowVerticalGrid" VALUE="-1">
<PARAM NAME="TitleFontColor" VALUE="10485760">
<PARAM NAME="ValueIsNull" VALUE="0">
</OBJECT>
<% Else %>
<SELECT name="month_s">
<%
For m = 1 to 12
if month(NOW()) = m then
Response.Write("<Option selected value=" & m & ">" & m )
else
Response.Write("<Option value=" & m & ">" & m )
end if
Next
%>
</SELECT>
<SELECT name="date_s">
<%
For d = 1 to 31
if day(NOW()) = d then
Response.Write("<Option selected value=" & d & ">" & d )
else
Response.Write("<Option value=" & d & ">" & d )
end if
Next
%>
</SELECT>
<SELECT name="year_s">
<%
For j = 1995 to 2020
if year(NOW()) = j then
Response.Write("<Option selected value=" & j & ">" & j )
else
Response.Write("<Option value=" & j & ">" & j )
end if
Next
%>
</SELECT>
<% End If %> Best regards,
René de Leeuw.