< html > < head > < meta http-equiv ="Content-Type" content ="text/html;charset=gb2312" > < title > 日历控件 </ title > </ head > < body > < OBJECT id =dtPicker style ="FONT-SIZE:12px;LEFT:0px;WIDTH:110px;FONT-FAMILY:宋体;TOP:0px;HEIGHT:20px" codeBase =http://activex.microsoft.com/controls/vb6/MSComCt2.cab classid ="clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1" > < PARAM NAME ="_ExtentX" VALUE ="2910" > < PARAM NAME ="_ExtentY" VALUE ="529" > < PARAM NAME ="_Version" VALUE ="393216" > < PARAM NAME ="MousePointer" VALUE ="0" > < PARAM NAME ="Enabled" VALUE ="1" > < PARAM NAME ="OLEDropMode" VALUE ="0" > < PARAM NAME ="CalendarBackColor" VALUE ="-2147483643" > < PARAM NAME ="CalendarForeColor" VALUE ="-2147483630" > < PARAM NAME ="CalendarTitleBackColor" VALUE ="7798784" > < PARAM NAME ="CalendarTitleForeColor" VALUE ="16777215" > < PARAM NAME ="CalendarTrailingForeColor" VALUE ="7829367" > < PARAM NAME ="CheckBox" VALUE ="0" > < PARAM NAME ="CustomFormat" VALUE ="yyyy-MM-dd" > < PARAM NAME ="DateIsNull" VALUE ="0" > < PARAM NAME ="Format" VALUE ="662831107" > < PARAM NAME ="UpDown" VALUE ="0" > < PARAM NAME ="CurrentDate" VALUE ="37582.0927083333" > < PARAM NAME ="MaxDate" VALUE ="2958465" > < PARAM NAME ="MinDate" VALUE ="-109205" ></ OBJECT > < a href ="javascript:get_Date()" > get_Date() </ a > < script FOR =dtPicker EVENT =CloseUp > ... alert(dtPicker.Year+"-"+dtPicker.Month+"-"+dtPicker.Day); </ script > < script language ="javascript" > ... functionget_Date()...{alert(dtPicker.Year+"-"+dtPicker.Month+"-"+dtPicker.Day);} </ script > </ body > </ html > 鼠标移动到上面或者用代码直接取值时,总会提示“在此页上的ActiveX 控件和本页的其他部分的交互可能不安全。你想允许这种交互吗?”。选择允许就可以了,简单吧。