日期控件

作者:网络 来源:佚名 更新时间:2008-02-05 10:30:45 点击:

function rlctrl()
{
// datectrl created by yyc 2000-6-18
// copyright (c) 2000.6 yyc, all rights reserved
// this is a free class,but you must be reserve this comments
// e-mail:[email protected]
var varme,s,d,i;
var len= rlctrl.arguments.length;
if (len>0)
{
varme=rlctrl.arguments[0];
this.name=varme;
if (len>=4)
{
this.year=rlctrl.arguments[1];
this.month=rlctrl.arguments[2];
this.day=rlctrl.arguments[3];
}
else
{
today=new date();
this.year=today.getyear();
this.month=today.getmonth()+1;
this.day=today.getdate();
}
this.getdate=getcurdate;

document.writeln('<table width=160px border=0 cellpadding=0 cellspacing=0>');
document.writeln('<tr><td>');
d=new date(this.year,this.month-1,this.day);
i=d.getday();
s=getsweek(i);
s=this.year+"年"+this.month+"月"+this.day+"日--"+s
document.writeln('<input id=txt'+varme+' name=txt'+varme+' ondblclick=\'opencls('+varme+');\' style="font-size: 9pt; font-style: normal; height: 20px; width:100%" value='+s+' readonly ></td>');
document.writeln('<td width=15px>');
document.writeln('<input type=button onclick=\'opencls('+varme+');\' style=" cursor:hand;font-size: 8pt; font-style: normal;" value="▼">');
document.writeln('</td></tr>');
document.writeln("</table>");

document.writeln('<div id=div'+varme+' name =div'+varme+' style=" position:absolute;display:none; width: 160px">');
document.writeln('<table id=tbl'+varme+' name=tbl'+varme+' width=100% bgcolor=#c0c0c0 onkeyup=\'dokey('+varme+',window.event.keycode) \' align=center style="color: blue; font-size: 9pt;" border=1 cellspacing=1 cellpadding=1>');
document.writeln("<tr><td colspan=7>");
document.writeln('<input id=year'+varme+' name=year'+varme+' value='+this.year+' style="background-color:transparent; border-bottom: green 0px solid;border-left: green 0px solid;border-right: green 0px solid; border-top: green 0px solid;color: blue;cursor: hand; font-size: 10pt; height: 15px; margin-top: 0pt; width: 35px" ');
document.writeln('onmousemove =\'javascript:if (this.readonly) {this.style.backgroundcolor=0xffffff; this.style.borderwidth=1;} \'');
document.writeln('onmouseout =\'javascript: if (this.readonly) { this.style.backgroundcolor ="transparent";this.style.borderwidth=0;} \' ');
document.writeln('onclick=\'javascript: this.style.cursor="default"; this.readonly=0; this.select(); this.focus(); \' ');
document.writeln('onblur=\'javascript:this.style.backgroundcolor="transparent"; this.style.borderwidth=0; this.style.cursor="hand"; this.readonly=1; this.value='+varme+'.year;dispdate('+varme+'); \' '); //tbl'+varme+'.focus();
document.writeln('onkeypress=\'javascript:if (window.event.keycode==13||window.event.keycode ==27){ if (window.event.keycode==13) '+varme+'.year=this.value; this.blur(); }else if (window.event.keycode<48||window.event.keycode>57) window.event.keycode =0;\'');
document.writeln('readonly maxlength=4>');
//=====================
document.writeln('年<span style="cursor:hand" onclick=\''+varme+'.year='+varme+'.year+1;year'+varme+'.innertext='+varme+'.year;dispdate('+varme+');\'>▲</span><span style="cursor:hand" onclick=\''+varme+'.year='+varme+'.year-1;year'+varme+'.innertext='+varme+'.year;dispdate('+varme+');\'>▼</span>');
document.writeln ('&nbsp;&nbsp;');
document.writeln('<span id=month'+varme+'>'+this.month+'</span>月<span style="cursor:hand" onclick=\''+varme+'.month='+varme+'.month+1;if('+varme+'.month>12) '+varme+'.month=1;month'+varme+'.innertext='+varme+'.month;dispdate('+varme+');\'>▲</span><span style="cursor:hand" onclick=\''+varme+'.month='+varme+'.month-1;if('+varme+'.month<1) '+varme+'.month=12;month'+varme+'.innertext='+varme+'.month;dispdate('+varme+');\'>▼</span>');
document.writeln("</td></tr>");
document.writeln('<tr style="color: yellow; " bgcolor=darkslateblue><td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</t