Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
function show_calendar() {
var gNow = new Date();
var ReturnItem = arguments[0];
if (arguments[1] == null)
inMonth = new String(gNow.getMonth()+1);
else
inMonth = arguments[1];
if (arguments[2] == null)
inDay = new String(gNow.getDate());
else
inDay = arguments[2];
if (arguments[3] == null)
inYear = new String(gNow.getYear());
else
inYear = arguments[3];
var scpHeader = "script";
var scpLanguage = "JavaScript";
var scpDash = "-";
var winProps = "toolbar=no,location=no,direction=no,status=no,menubar=no,scrollbars=no,resizable=no,width=165,height=165,left=" + StartLeft + ",top=" + StartTop;

wCal = window.open('','winCalendar',winProps);
wCal.opener = self;
wCal.document.writeln('<html><META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"><META HTTP-EQUIV="Expires" content="<%=Now%>"><TITLE>Select Date</TITLE>');
wCal.document.writeln('<BODY Style="background-repeat:no-repeat;background-position:center;" bgcolor="white" background="/graphics/sbc_color_med.gif" bgproperties=fixed topmargin=0 leftmargin=0>');
wCal.document.writeln('');
wCal.document.writeln('<' + scpHeader + ' language="' + scpLanguage + '" FOR="Calendar1" EVENT="Click()">');
wCal.document.writeln('<!' + scpDash + scpDash);
wCal.document.writeln(' ReturnDate = this.month+"/"+this.day+"/"+this.year;');
wCal.document.writeln(' self.opener.document.' + ReturnItem + '.value = ReturnDate;');
wCal.document.writeln(' self.opener.document.' + ReturnItem + '.select();');
wCal.document.writeln(' self.opener.document.' + ReturnItem + '.focus();');
wCal.document.writeln(' self.close();');
wCal.document.writeln('\/\/' + scpDash + scpDash + '>');
wCal.document.writeln('<\/' + scpHeader + '>');
wCal.document.writeln('
');
wCal.document.writeln('<object id=Calendar1 classid=clsid:8E27C92B-1264-101C-8A2F-040224009C02 width=165 height=165>');
wCal.document.writeln('<param name="Year" value="'+inYear+'" />');
wCal.document.writeln('<param name="Month" value="'+inMonth+'" />');
wCal.document.writeln('<param name="Day" value="'+inDay+'" />');
wCal.document.writeln('</object></body></html>');
wCal.document.close();
}
Posted

1 solution

Using an ActiveX control for your calendar isn't going to work in anything other than Internet Explorer on Windows. The user will also need to have the ActiveX control installed, and will potentially need to change their security settings.

Try using one of the many Javascript date pickers which don't rely on an ActiveX control. For example: http://jqueryui.com/datepicker/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900