弹出式时间选择器
1
/*
2
****************************************************
3
功 能:时间选择控件
4
说 明:
5
版 本:1.0
6
创建时间:2005-8-16
7
***************************************************
8
*/
9
10
<!--
11
var bMoveable=true;
12
//var _VersionInfo="(JavaScript)Version:2.0|2.0作者:walkingpoison|1.0作者: F.R.Huang(meizz)|MAIL: meizz@hzcnc.com|";
13
//_VersionInfo+="(Control)Version:1.0作者:Damao|MAIL: prettywolf@vip.sina.com";
14
var strFrame;
15
document.writeln('<iframe bgcolor="#000000" id=meizzDateLayer frameborder=0 style="position: absolute; width: 186; height: 247; z-index: 9998; display: none"></iframe>');
16
strFrame='<style>';
17
strFrame+='INPUT.button{BORDER-RIGHT: #B3C9E1 1px solid;BORDER-TOP: #B3C9E1 1px solid;BORDER-LEFT: #B3C9E1 1px solid;';
18
strFrame+='BORDER-BOTTOM: #ff9900 1px solid;BACKGROUND-COLOR: #EDF2F8;font-family:宋体;}';
19
strFrame+='TD{FONT-SIZE: 9pt;font-family:宋体;}';
20
strFrame+='</style>';
21
strFrame+='<scr'+'ipt>';
22
strFrame+='var datelayerx,datelayery;';
23
strFrame+='var bDrag; ';
24
strFrame+='function document.onmousemove() ';
25
strFrame+='{if(bDrag && window.event.button==1)';
26
strFrame+=' {var DateLayer=parent.document.all.meizzDateLayer.style;';
27
strFrame+=' DateLayer.posLeft += window.event.clientX-datelayerx;';
28
strFrame+=' DateLayer.posTop += window.event.clientY-datelayery;}}';
29
strFrame+='function DragStart() ';
30
strFrame+='{var DateLayer=parent.document.all.meizzDateLayer.style;';
31
strFrame+=' datelayerx=window.event.clientX;';
32
strFrame+=' datelayery=window.event.clientY;';
33
strFrame+=' bDrag=true;}';
34
strFrame+='function DragEnd(){ ';
35
strFrame+=' bDrag=false;}';
36
strFrame+='</scr'+'ipt>';
37
strFrame+='<div style="z-index:9999;position: absolute; left:0; top:0;" onselectstart="return false"><span id=tmpSelectYearLayer style="z-index: 9999;position: absolute;top: 3; left: 19;display: none"></span>';
38
strFrame+='<span id=tmpSelectMonthLayer style="z-index: 9999;position: absolute;top: 3; left: 78;display: none"></span>';
39
strFrame+='<table style="FILTER:dropshadow(color=#EDEDF8,offx=3.3,offy=3.3,positive=1);" cellSpacing="0" cellPadding="0" width="100%" border="0"><tr><td>';
40
strFrame+='<table border=1 cellspacing=0 cellpadding=0 width=182 height=160 bgColor="#FFFFFF" borderColorLight=#7197CA borderColorDark="#ffffff" >';
41
strFrame+=' <tr ><td width=182 height=23 bgcolor=#FFFFFF><table border=0 cellspacing=1 cellpadding=0 width=180 height=23>';
42
strFrame+=' <tr align=center ><td width=16 align=center bgcolor=#B6CAE4 style="font-size:12px;cursor: hand;color: #ffffff" ';
43
strFrame+=' onclick="parent.meizzPrevM()" title="向前翻 1 月" ><b ><</b>';
44
strFrame+=' </td><td width=60 align=center style="font-size:12px;cursor:hand;" ';
45
strFrame+='onmouseover="style.backgroundColor=\'#D7E1F0\'" onmouseout="style.backgroundColor=\'white\'" ';
46
strFrame+='onclick="parent.tmpSelectYearInnerHTML(this.innerText.substring(0,4))" title="点击这里选择年份"><span id=meizzYearHead></span></td>';
47
strFrame+='<td width=48 align=center style="font-size:12px;cursor:hand;" onmouseover="style.backgroundColor=\'#D7E1F0\'" ';
48
strFrame+=' onmouseout="style.backgroundColor=\'white\'" onclick="parent.tmpSelectMonthInnerHTML(this.innerText.length==3?this.innerText.substring(0,1):this.innerText.substring(0,2))"';
49
strFrame+=' title="点击这里选择月份"><span id=meizzMonthHead ></span></td>';
50
strFrame+=' <td width=16 bgcolor=#B6CAE4 align=center style="font-size:12px;cursor: hand;color: #ffffff" ';
51
strFrame+=' onclick="parent.meizzNextM()" title="向后翻 1 月" ><b >></b></td></tr>';
52
strFrame+=' </table></td></tr>';
53
strFrame+=' <tr ><td width=180 height=18 >';
54
strFrame+='<table border=1 cellspacing=0 cellpadding=0 bgcolor=#618BC5 ' + (bMoveable? 'onmousedown="DragStart()" onmouseup="DragEnd()"':'');
55
strFrame+=' BORDERCOLORLIGHT=#3677b1 bgcolor=#5168C8 BORDERCOLORDARK=#FFFFFF width="100%" height=25 style="cursor:' + (bMoveable ? 'move':'default') + '">';
56
strFrame+='<tr valign="middle" align="center"><td style="font-size:12px;color:#FFFFFF" ><b>日</b></td>';
57
strFrame+='<td style="font-size:12px;color:#FFFFFF" ><b>一</b></td><td style="font-size:12px;color:#FFFFFF" ><b>二</b></td>';
58
strFrame+='<td style="font-size:12px;color:#FFFFFF" ><b>三</b></td><td style="font-size:12px;color:#FFFFFF" ><b>四</b></td>';
59
strFrame+='<td style="font-size:12px;color:#FFFFFF" ><b>五</b></td><td style="font-size:12px;color:#FFFFFF" ><b>六</b></td></tr>';
60
strFrame+='</table></td></tr>';
61
strFrame+=' <tr ><td width="100%" height=120 >';
62
strFrame+=' <table border=1 cellspacing=2 cellpadding=0 borderColorDark=#ffffff bgColor=#FFFFFF borderColorLight=#83A4D1 width="100%" height=120 >';
63
var n=0; for (j=0;j<5;j++){ strFrame+= ' <tr align=center >'; for (i=0;i<7;i++){
64
strFrame+='<td width=25 height=25 id=meizzDay'+n+' style="font-size:12px" onclick=parent.meizzDayClick(this.innerText,0)></td>';n++;}
65
strFrame+='</tr>';}
66
strFrame+=' <tr align=center >';
67
for (i=35;i<39;i++)strFrame+='<td width=25 height=25 id=meizzDay'+i+' style="font-size:12px" onclick="parent.meizzDayClick(this.innerText,0)"></td>';
68
strFrame+=' <td colspan=3 align=right ><span onclick=parent.closeLayer() style="font-size:12px;cursor: hand"';
69
strFrame+=' title="关闭时间选择"><u>关闭</u></span> </td></tr>';
70
strFrame+=' </table></td></tr><tr ><td >';
71
strFrame+=' <table border=0 cellspacing=1 cellpadding=0 width=100% bgcolor=#FFFFFF>';
72
strFrame+=' <tr ><td align=left><input type=button class=button style="cursor:hand" value="<<" title="向前翻 1 年" onclick="parent.meizzPrevY()" ';
73
strFrame+=' onfocus="this.blur()" style="font-size: 12px; height: 20px"><input class=button title="向前翻 1 月" type=button ';
74
strFrame+=' value="< " style="cursor:hand" onclick="parent.meizzPrevM()" onfocus="this.blur()" style="font-size: 12px; height: 20px"></td><td ';
75
strFrame+=' align=center><input style="cursor:hand" type=button class=button value="今日" onclick="parent.meizzToday()" ';
76
strFrame+=' onfocus="this.blur()" title="当前日期" style="font-size: 12px; height: 20px; cursor:hand"></td><td ';
77
//added by wayne @050816
78
strFrame+=' align=center><input style="cursor:hand" type=button class=button value="清空" onclick="parent.ClearDate()" ';
79
strFrame+=' onfocus="this.blur()" title="清除日期" style="font-size: 12px; height: 20px; cursor:hand"></td><td ';
80
81
strFrame+=' align=right><input type=button class=button value=" >" style="cursor:hand" onclick="parent.meizzNextM()" ';
82
strFrame+=' onfocus="this.blur()" title="向后翻 1 月" class=button style="font-size: 12px; height: 20px"><input ';
83
strFrame+=' type=button class=button style="cursor:hand" value=">>" title="向后翻 1 年" onclick="parent.meizzNextY()"';
84
strFrame+=' onfocus="this.blur()" style="font-size: 12px; height: 20px"></td>';
85
strFrame+='</tr></table></td></tr></table></td></tr></table></div>';
86
window.frames.meizzDateLayer.document.writeln(strFrame);
87
window.frames.meizzDateLayer.document.close();
88
var outObject;
89
var outButton;
90
var outDate="";
91
var odatelayer=window.frames.meizzDateLayer.document.all;
92
93
function setday(tt,obj){
94
if (arguments.length > 2){alert("对不起!传入本控件的参数太多!");return;}
95
if (arguments.length == 0){alert("对不起!您没有传回本控件任何参数!");return;}
96
var dads = document.all.meizzDateLayer.style;
97
var th = tt;
98
var ttop = tt.offsetTop;
99
var thei = tt.clientHeight;
100
var tleft = tt.offsetLeft;
101
var ttyp = tt.type;
102
while (tt = tt.offsetParent){ttop+=tt.offsetTop; tleft+=tt.offsetLeft;}
103
dads.top = (ttyp=="image")? ttop+thei : ttop+thei+6;
104
dads.left = tleft;
105
outObject = (arguments.length == 1) ? th : obj;
106
outButton = (arguments.length == 1) ? null : th;
107
var reg = /^(\d+)-(\d{1,2})-(\d{1,2})$/;
108
var r = outObject.value.match(reg);
109
if(r!=null){
110
r[2]=r[2]-1;
111
var d= new Date(r[1], r[2],r[3]);
112
if(d.getFullYear()==r[1] && d.getMonth()==r[2] && d.getDate()==r[3]){
113
outDate=d;
114
}
115
else outDate="";
116
meizzSetDay(r[1],r[2]+1);
117
}
118
else{
119
outDate="";
120
meizzSetDay(new Date().getFullYear(), new Date().getMonth() + 1);
121
}
122
dads.display = '';
123
event.returnValue=false;
124
}
125
var MonHead = new Array(12);
126
MonHead[0] = 31; MonHead[1] = 28; MonHead[2] = 31; MonHead[3] = 30; MonHead[4] = 31; MonHead[5] = 30;
127
MonHead[6] = 31; MonHead[7] = 31; MonHead[8] = 30; MonHead[9] = 31; MonHead[10] = 30; MonHead[11] = 31;
128
var meizzTheYear=new Date().getFullYear();
129
var meizzTheMonth=new Date().getMonth()+1;
130
var meizzWDay=new Array(39);
131
132
//判断是否隐藏显示出来的时间显示层
133
function document.onclick()
134
{
135
with(window.event)
136
{
137
if (srcElement != outObject && srcElement != outButton)
138
closeLayer();
139
}
140
}
141
function document.onkeyup(){
142
if (window.event.keyCode==27){
143
if(outObject)outObject.blur();
144
closeLayer();
145
}
146
else if(document.activeElement)
147
if(document.activeElement != outObject && document.activeElement != outButton)
148
{closeLayer();}
149
}
150
function meizzWriteHead(yy,mm){
151
odatelayer.meizzYearHead.innerText = yy + " 年";
152
odatelayer.meizzMonthHead.innerText = mm + " 月";
153
}
154
function tmpSelectYearInnerHTML(strYear){
155
if (strYear.match(/\D/)!=null){alert("年份输入参数不是数字!");return;}
156
var m = (strYear) ? strYear : new Date().getFullYear();
157
if (m < 1000 || m > 9999) {alert("年份值不在 1000 到 9999 之间!");return;}
158
//年份选择起始
159
var n = m - 65;
160
if (n < 1000) n = 1000;
161
if (n + 71 > 9999) n = 9929;
162
var s = " <select name=tmpSelectYear style='font-size: 12px' "
163
s += "onblur='document.all.tmpSelectYearLayer.style.display=\"none\"' "
164
s += "onchange='document.all.tmpSelectYearLayer.style.display=\"none\";"
165
s += "parent.meizzTheYear = this.value; parent.meizzSetDay(parent.meizzTheYear,parent.meizzTheMonth)'>\r\n";
166
var selectInnerHTML = s;
167
for (var i = n; i < n + 71; i++){
168
if (i == m)
169
{selectInnerHTML += "<option value='" + i + "' selected>" + i + "年" + "</option>\r\n";}
170
else {selectInnerHTML += "<option value='" + i + "'>" + i + "年" + "</option>\r\n";}
171
}
172
selectInnerHTML += "</select>";
173
odatelayer.tmpSelectYearLayer.style.display="";
174
odatelayer.tmpSelectYearLayer.innerHTML = selectInnerHTML;
175
odatelayer.tmpSelectYear.focus();
176
}
177
function tmpSelectMonthInnerHTML(strMonth){
178
if (strMonth.match(/\D/)!=null){alert('月份输入参数不是数字!');return;}
179
var m = (strMonth) ? strMonth : new Date().getMonth() + 1;
180
var s = " <select name=tmpSelectMonth style='font-size: 12px' "
181
s += "onblur='document.all.tmpSelectMonthLayer.style.display=\"none\"' "
182
s += "onchange='document.all.tmpSelectMonthLayer.style.display=\"none\";"
183
s += "parent.meizzTheMonth = this.value; parent.meizzSetDay(parent.meizzTheYear,parent.meizzTheMonth)'>\r\n ";
184
var selectInnerHTML = s;
185
for (var i = 1; i < 13; i++){
186
if (i == m)
187
{selectInnerHTML += "<option value='"+i+"' selected>"+i+"月"+"</option>\r\n";}
188
else {selectInnerHTML += "<option value='"+i+"'>"+i+"月"+"</option>\r\n";}
189
}
190
selectInnerHTML += "</select>";
191
odatelayer.tmpSelectMonthLayer.style.display="";
192
odatelayer.tmpSelectMonthLayer.innerHTML = selectInnerHTML;
193
odatelayer.tmpSelectMonth.focus();
194
}
195
function closeLayer(){
196
document.all.meizzDateLayer.style.display="none";
197
}
198
function IsPinYear(year){
199
if (0==year%4&&((year%100!=0)||(year%400==0))) return true;else return false;
200
}
201
function GetMonthCount(year,month){
202
var c=MonHead[month-1];if((month==2)&&IsPinYear(year)) c++;return c;
203
}
204
function GetDOW(day,month,year){
205
var dt=new Date(year,month-1,day).getDay()/7; return dt;
206
}
207
function meizzPrevY(){
208
if(meizzTheYear > 999 && meizzTheYear <10000){meizzTheYear--;}
209
else{alert("年份超出范围(1000-9999)!");}
210
meizzSetDay(meizzTheYear,meizzTheMonth);
211
}
212
function meizzNextY(){
213
if(meizzTheYear > 999 && meizzTheYear <10000){meizzTheYear++;}
214
else{alert("年份超出范围(1000-9999)!");}
215
meizzSetDay(meizzTheYear,meizzTheMonth);
216
}
217
function meizzToday(){
218
var today;
219
meizzTheYear = new Date().getFullYear();
220
meizzTheMonth = new Date().getMonth()+1;
221
today=new Date().getDate();
222
if(outObject){
223
outObject.value=meizzTheYear + "-" + meizzTheMonth + "-" + today;
224
}
225
closeLayer();
226
}
227
228
//added by wayne 050816
229
//ClearDate
230
function ClearDate(){
231
if(outObject){
232
outObject.value="";
233
}
234
closeLayer();
235
}
236
237
function meizzPrevM(){
238
if(meizzTheMonth>1){meizzTheMonth--}else{meizzTheYear--;meizzTheMonth=12;}
239
meizzSetDay(meizzTheYear,meizzTheMonth);
240
}
241
function meizzNextM(){
242
if(meizzTheMonth==12){meizzTheYear++;meizzTheMonth=1}else{meizzTheMonth++}
243
meizzSetDay(meizzTheYear,meizzTheMonth);
244
}
245
function meizzSetDay(yy,mm){
246
meizzWriteHead(yy,mm);
247
meizzTheYear=yy;
248
meizzTheMonth=mm;
249
for (var i = 0; i < 39; i++){meizzWDay[i]=""};
250
var day1 = 1,day2=1,firstday = new Date(yy,mm-1,1).getDay();
251
for (i=0;i<firstday;i++)meizzWDay[i]=GetMonthCount(mm==1?yy-1:yy,mm==1?12:mm-1)-firstday+i+1
252
for (i = firstday; day1 < GetMonthCount(yy,mm)+1; i++){meizzWDay[i]=day1;day1++;}
253
for (i=firstday+GetMonthCount(yy,mm);i<39;i++){meizzWDay[i]=day2;day2++}
254
for (i = 0; i < 39; i++)
255
{ var da = eval("odatelayer.meizzDay"+i)
256
if (meizzWDay[i]!=""){
257
da.borderColorLight="#76A0CF";
258
da.borderColorDark="#76A0CF";
259
if(i<firstday){
260
da.innerHTML="<font style=' color: #B5C5D2;'>" + meizzWDay[i] + "</font>";
261
da.title=(mm==1?12:mm-1) +"月" + meizzWDay[i] + "日";
262
da.onclick=Function("meizzDayClick(this.innerText,-1)");
263
if(!outDate)
264
da.style.backgroundColor = ((mm==1?yy-1:yy) == new Date().getFullYear() &&
265
(mm==1?12:mm-1) == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate()) ?
266
"#E4E3F2":"#FFFFFF";
267
else{
268
da.style.backgroundColor =((mm==1?yy-1:yy)==outDate.getFullYear() && (mm==1?12:mm-1)== outDate.getMonth() + 1 &&
269
meizzWDay[i]==outDate.getDate())? "#E8F5E7" :
270
(((mm==1?yy-1:yy) == new Date().getFullYear() && (mm==1?12:mm-1) == new Date().getMonth()+1 &&
271
meizzWDay[i] == new Date().getDate()) ? "#E4E3F2":"#FFFFFF");
272
if((mm==1?yy-1:yy)==outDate.getFullYear() && (mm==1?12:mm-1)== outDate.getMonth() + 1 &&
273
meizzWDay[i]==outDate.getDate())
274
{}
275
}
276
}
277
else if (i>=firstday+GetMonthCount(yy,mm)){
278
da.innerHTML="<font style=' color: #B5C5D2;'>" + meizzWDay[i] + "</font>";
279
da.title=(mm==12?1:mm+1) +"月" + meizzWDay[i] + "日";
280
da.onclick=Function("meizzDayClick(this.innerText,1)");
281
if(!outDate)
282
da.style.backgroundColor = ((mm==12?yy+1:yy) == new Date().getFullYear() &&
283
(mm==12?1:mm+1) == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate()) ?
284
"#E4E3F2":"#FFFFFF";
285
else{
286
da.style.backgroundColor =((mm==12?yy+1:yy)==outDate.getFullYear() && (mm==12?1:mm+1)== outDate.getMonth() + 1 &&
287
meizzWDay[i]==outDate.getDate())? "#E8F5E7" :
288
(((mm==12?yy+1:yy) == new Date().getFullYear() && (mm==12?1:mm+1) == new Date().getMonth()+1 &&
289
meizzWDay[i] == new Date().getDate()) ? "#E4E3F2":"#FFFFFF");
290
if((mm==12?yy+1:yy)==outDate.getFullYear() && (mm==12?1:mm+1)== outDate.getMonth() + 1 &&
291
meizzWDay[i]==outDate.getDate()){
292
da.borderColorLight="#E4E3F2";
293
da.borderColorDark="#E4E3F2";
294
}
295
}
296
}
297
else{
298
da.innerHTML="<font style=' color: #3E5468;'>" + meizzWDay[i] + "</FONT>";
299
da.title=mm +"月" + meizzWDay[i] + "日";
300
da.onclick=Function("meizzDayClick(this.innerText,0)");
301
if(!outDate)
302
da.style.backgroundColor = (yy == new Date().getFullYear() && mm == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate())?
303
"#FFFFFF":"#FFFFFF";
304
else{
305
da.style.backgroundColor =(yy==outDate.getFullYear() && mm== outDate.getMonth() + 1 && meizzWDay[i]==outDate.getDate())?
306
"#D5ECD2":((yy == new Date().getFullYear() && mm == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate())?
307
"#E4E3F2":"#F8F8FC");
308
}
309
}
310
da.style.cursor="hand"
311
da.onmouseover=Function("this.backgroundColor='#000000';this.borderColorDark='#000099';this.borderColorLight='#000099';");
312
da.onmouseout=Function("this.bgColor='#000000';this.borderColorDark='#9CBADE';this.borderColorLight='#9CBADE';");
313
}
314
else{da.innerHTML="";da.style.backgroundColor="";da.style.cursor="default";da.onmouseover=Function("this.backgroundColor='#000000';this.borderColorDark='#000099';this.borderColorLight='#000099';");
315
da.onmouseout=Function("this.bgColor='#000000';this.borderColorDark='#9CBADE';this.borderColorLight='#9CBADE';");}
316
}}
317
function meizzDayClick(n,ex){
318
var yy=meizzTheYear;
319
var mm = parseInt(meizzTheMonth)+ex;
320
if(mm<1){
321
yy--;
322
mm=12+mm;
323
}
324
else if(mm>12){
325
yy++;
326
mm=mm-12;
327
}
328
if (mm < 10){mm = "0" + mm;}
329
if (outObject){
330
if (!n) {
331
return;}
332
if ( n < 10){n = "0" + n;}
333
outObject.value= yy + "-" + mm + "-" + n ;
334
closeLayer();
335
outObject.onchange();
336
}
337
else {closeLayer(); alert("您所要输出的控件对象并不存在!");}
338
}
339
//-->
/*2
****************************************************3
功 能:时间选择控件4
说 明:5
版 本:1.06
创建时间:2005-8-167
***************************************************8
*/9

10
<!--11
var bMoveable=true;12
//var _VersionInfo="(JavaScript)Version:2.0|2.0作者:walkingpoison|1.0作者: F.R.Huang(meizz)|MAIL: meizz@hzcnc.com|";13
//_VersionInfo+="(Control)Version:1.0作者:Damao|MAIL: prettywolf@vip.sina.com";14
var strFrame;15
document.writeln('<iframe bgcolor="#000000" id=meizzDateLayer frameborder=0 style="position: absolute; width: 186; height: 247; z-index: 9998; display: none"></iframe>');16
strFrame='<style>';17
strFrame+='INPUT.button{BORDER-RIGHT: #B3C9E1 1px solid;BORDER-TOP: #B3C9E1 1px solid;BORDER-LEFT: #B3C9E1 1px solid;';18
strFrame+='BORDER-BOTTOM: #ff9900 1px solid;BACKGROUND-COLOR: #EDF2F8;font-family:宋体;}';19
strFrame+='TD{FONT-SIZE: 9pt;font-family:宋体;}';20
strFrame+='</style>';21
strFrame+='<scr'+'ipt>';22
strFrame+='var datelayerx,datelayery;';23
strFrame+='var bDrag; ';24
strFrame+='function document.onmousemove() ';25
strFrame+='{if(bDrag && window.event.button==1)';26
strFrame+=' {var DateLayer=parent.document.all.meizzDateLayer.style;';27
strFrame+=' DateLayer.posLeft += window.event.clientX-datelayerx;';28
strFrame+=' DateLayer.posTop += window.event.clientY-datelayery;}}';29
strFrame+='function DragStart() ';30
strFrame+='{var DateLayer=parent.document.all.meizzDateLayer.style;';31
strFrame+=' datelayerx=window.event.clientX;';32
strFrame+=' datelayery=window.event.clientY;';33
strFrame+=' bDrag=true;}';34
strFrame+='function DragEnd(){ ';35
strFrame+=' bDrag=false;}';36
strFrame+='</scr'+'ipt>';37
strFrame+='<div style="z-index:9999;position: absolute; left:0; top:0;" onselectstart="return false"><span id=tmpSelectYearLayer style="z-index: 9999;position: absolute;top: 3; left: 19;display: none"></span>';38
strFrame+='<span id=tmpSelectMonthLayer style="z-index: 9999;position: absolute;top: 3; left: 78;display: none"></span>';39
strFrame+='<table style="FILTER:dropshadow(color=#EDEDF8,offx=3.3,offy=3.3,positive=1);" cellSpacing="0" cellPadding="0" width="100%" border="0"><tr><td>';40
strFrame+='<table border=1 cellspacing=0 cellpadding=0 width=182 height=160 bgColor="#FFFFFF" borderColorLight=#7197CA borderColorDark="#ffffff" >';41
strFrame+=' <tr ><td width=182 height=23 bgcolor=#FFFFFF><table border=0 cellspacing=1 cellpadding=0 width=180 height=23>';42
strFrame+=' <tr align=center ><td width=16 align=center bgcolor=#B6CAE4 style="font-size:12px;cursor: hand;color: #ffffff" ';43
strFrame+=' onclick="parent.meizzPrevM()" title="向前翻 1 月" ><b ><</b>';44
strFrame+=' </td><td width=60 align=center style="font-size:12px;cursor:hand;" ';45
strFrame+='onmouseover="style.backgroundColor=\'#D7E1F0\'" onmouseout="style.backgroundColor=\'white\'" ';46
strFrame+='onclick="parent.tmpSelectYearInnerHTML(this.innerText.substring(0,4))" title="点击这里选择年份"><span id=meizzYearHead></span></td>';47
strFrame+='<td width=48 align=center style="font-size:12px;cursor:hand;" onmouseover="style.backgroundColor=\'#D7E1F0\'" ';48
strFrame+=' onmouseout="style.backgroundColor=\'white\'" onclick="parent.tmpSelectMonthInnerHTML(this.innerText.length==3?this.innerText.substring(0,1):this.innerText.substring(0,2))"';49
strFrame+=' title="点击这里选择月份"><span id=meizzMonthHead ></span></td>';50
strFrame+=' <td width=16 bgcolor=#B6CAE4 align=center style="font-size:12px;cursor: hand;color: #ffffff" ';51
strFrame+=' onclick="parent.meizzNextM()" title="向后翻 1 月" ><b >></b></td></tr>';52
strFrame+=' </table></td></tr>';53
strFrame+=' <tr ><td width=180 height=18 >';54
strFrame+='<table border=1 cellspacing=0 cellpadding=0 bgcolor=#618BC5 ' + (bMoveable? 'onmousedown="DragStart()" onmouseup="DragEnd()"':'');55
strFrame+=' BORDERCOLORLIGHT=#3677b1 bgcolor=#5168C8 BORDERCOLORDARK=#FFFFFF width="100%" height=25 style="cursor:' + (bMoveable ? 'move':'default') + '">';56
strFrame+='<tr valign="middle" align="center"><td style="font-size:12px;color:#FFFFFF" ><b>日</b></td>';57
strFrame+='<td style="font-size:12px;color:#FFFFFF" ><b>一</b></td><td style="font-size:12px;color:#FFFFFF" ><b>二</b></td>';58
strFrame+='<td style="font-size:12px;color:#FFFFFF" ><b>三</b></td><td style="font-size:12px;color:#FFFFFF" ><b>四</b></td>';59
strFrame+='<td style="font-size:12px;color:#FFFFFF" ><b>五</b></td><td style="font-size:12px;color:#FFFFFF" ><b>六</b></td></tr>';60
strFrame+='</table></td></tr>';61
strFrame+=' <tr ><td width="100%" height=120 >';62
strFrame+=' <table border=1 cellspacing=2 cellpadding=0 borderColorDark=#ffffff bgColor=#FFFFFF borderColorLight=#83A4D1 width="100%" height=120 >';63
var n=0; for (j=0;j<5;j++){ strFrame+= ' <tr align=center >'; for (i=0;i<7;i++){64
strFrame+='<td width=25 height=25 id=meizzDay'+n+' style="font-size:12px" onclick=parent.meizzDayClick(this.innerText,0)></td>';n++;}65
strFrame+='</tr>';}66
strFrame+=' <tr align=center >';67
for (i=35;i<39;i++)strFrame+='<td width=25 height=25 id=meizzDay'+i+' style="font-size:12px" onclick="parent.meizzDayClick(this.innerText,0)"></td>';68
strFrame+=' <td colspan=3 align=right ><span onclick=parent.closeLayer() style="font-size:12px;cursor: hand"';69
strFrame+=' title="关闭时间选择"><u>关闭</u></span> </td></tr>';70
strFrame+=' </table></td></tr><tr ><td >';71
strFrame+=' <table border=0 cellspacing=1 cellpadding=0 width=100% bgcolor=#FFFFFF>';72
strFrame+=' <tr ><td align=left><input type=button class=button style="cursor:hand" value="<<" title="向前翻 1 年" onclick="parent.meizzPrevY()" ';73
strFrame+=' onfocus="this.blur()" style="font-size: 12px; height: 20px"><input class=button title="向前翻 1 月" type=button ';74
strFrame+=' value="< " style="cursor:hand" onclick="parent.meizzPrevM()" onfocus="this.blur()" style="font-size: 12px; height: 20px"></td><td ';75
strFrame+=' align=center><input style="cursor:hand" type=button class=button value="今日" onclick="parent.meizzToday()" ';76
strFrame+=' onfocus="this.blur()" title="当前日期" style="font-size: 12px; height: 20px; cursor:hand"></td><td ';77
//added by wayne @050816 78
strFrame+=' align=center><input style="cursor:hand" type=button class=button value="清空" onclick="parent.ClearDate()" ';79
strFrame+=' onfocus="this.blur()" title="清除日期" style="font-size: 12px; height: 20px; cursor:hand"></td><td ';80

81
strFrame+=' align=right><input type=button class=button value=" >" style="cursor:hand" onclick="parent.meizzNextM()" ';82
strFrame+=' onfocus="this.blur()" title="向后翻 1 月" class=button style="font-size: 12px; height: 20px"><input ';83
strFrame+=' type=button class=button style="cursor:hand" value=">>" title="向后翻 1 年" onclick="parent.meizzNextY()"';84
strFrame+=' onfocus="this.blur()" style="font-size: 12px; height: 20px"></td>';85
strFrame+='</tr></table></td></tr></table></td></tr></table></div>';86
window.frames.meizzDateLayer.document.writeln(strFrame);87
window.frames.meizzDateLayer.document.close();88
var outObject;89
var outButton;90
var outDate="";91
var odatelayer=window.frames.meizzDateLayer.document.all;92

93
function setday(tt,obj){94
if (arguments.length > 2){alert("对不起!传入本控件的参数太多!");return;}95
if (arguments.length == 0){alert("对不起!您没有传回本控件任何参数!");return;}96
var dads = document.all.meizzDateLayer.style;97
var th = tt;98
var ttop = tt.offsetTop; 99
var thei = tt.clientHeight; 100
var tleft = tt.offsetLeft; 101
var ttyp = tt.type; 102
while (tt = tt.offsetParent){ttop+=tt.offsetTop; tleft+=tt.offsetLeft;}103
dads.top = (ttyp=="image")? ttop+thei : ttop+thei+6;104
dads.left = tleft;105
outObject = (arguments.length == 1) ? th : obj;106
outButton = (arguments.length == 1) ? null : th; 107
var reg = /^(\d+)-(\d{1,2})-(\d{1,2})$/; 108
var r = outObject.value.match(reg); 109
if(r!=null){110
r[2]=r[2]-1; 111
var d= new Date(r[1], r[2],r[3]); 112
if(d.getFullYear()==r[1] && d.getMonth()==r[2] && d.getDate()==r[3]){113
outDate=d;114
}115
else outDate="";116
meizzSetDay(r[1],r[2]+1);117
}118
else{119
outDate="";120
meizzSetDay(new Date().getFullYear(), new Date().getMonth() + 1);121
}122
dads.display = '';123
event.returnValue=false;124
}125
var MonHead = new Array(12);126
MonHead[0] = 31; MonHead[1] = 28; MonHead[2] = 31; MonHead[3] = 30; MonHead[4] = 31; MonHead[5] = 30;127
MonHead[6] = 31; MonHead[7] = 31; MonHead[8] = 30; MonHead[9] = 31; MonHead[10] = 30; MonHead[11] = 31;128
var meizzTheYear=new Date().getFullYear(); 129
var meizzTheMonth=new Date().getMonth()+1; 130
var meizzWDay=new Array(39);131

132
//判断是否隐藏显示出来的时间显示层133
function document.onclick()134
{ 135
with(window.event)136
{ 137
if (srcElement != outObject && srcElement != outButton)138
closeLayer();139
}140
}141
function document.onkeyup(){142
if (window.event.keyCode==27){143
if(outObject)outObject.blur();144
closeLayer();145
}146
else if(document.activeElement)147
if(document.activeElement != outObject && document.activeElement != outButton)148
{closeLayer();}149
}150
function meizzWriteHead(yy,mm){151
odatelayer.meizzYearHead.innerText = yy + " 年";152
odatelayer.meizzMonthHead.innerText = mm + " 月";153
}154
function tmpSelectYearInnerHTML(strYear){155
if (strYear.match(/\D/)!=null){alert("年份输入参数不是数字!");return;}156
var m = (strYear) ? strYear : new Date().getFullYear();157
if (m < 1000 || m > 9999) {alert("年份值不在 1000 到 9999 之间!");return;}158
//年份选择起始159
var n = m - 65;160
if (n < 1000) n = 1000;161
if (n + 71 > 9999) n = 9929;162
var s = " <select name=tmpSelectYear style='font-size: 12px' "163
s += "onblur='document.all.tmpSelectYearLayer.style.display=\"none\"' "164
s += "onchange='document.all.tmpSelectYearLayer.style.display=\"none\";"165
s += "parent.meizzTheYear = this.value; parent.meizzSetDay(parent.meizzTheYear,parent.meizzTheMonth)'>\r\n";166
var selectInnerHTML = s;167
for (var i = n; i < n + 71; i++){168
if (i == m)169
{selectInnerHTML += "<option value='" + i + "' selected>" + i + "年" + "</option>\r\n";}170
else {selectInnerHTML += "<option value='" + i + "'>" + i + "年" + "</option>\r\n";}171
}172
selectInnerHTML += "</select>";173
odatelayer.tmpSelectYearLayer.style.display="";174
odatelayer.tmpSelectYearLayer.innerHTML = selectInnerHTML;175
odatelayer.tmpSelectYear.focus();176
}177
function tmpSelectMonthInnerHTML(strMonth){178
if (strMonth.match(/\D/)!=null){alert('月份输入参数不是数字!');return;} 179
var m = (strMonth) ? strMonth : new Date().getMonth() + 1;180
var s = " <select name=tmpSelectMonth style='font-size: 12px' "181
s += "onblur='document.all.tmpSelectMonthLayer.style.display=\"none\"' "182
s += "onchange='document.all.tmpSelectMonthLayer.style.display=\"none\";"183
s += "parent.meizzTheMonth = this.value; parent.meizzSetDay(parent.meizzTheYear,parent.meizzTheMonth)'>\r\n ";184
var selectInnerHTML = s;185
for (var i = 1; i < 13; i++){186
if (i == m)187
{selectInnerHTML += "<option value='"+i+"' selected>"+i+"月"+"</option>\r\n";}188
else {selectInnerHTML += "<option value='"+i+"'>"+i+"月"+"</option>\r\n";}189
}190
selectInnerHTML += "</select>";191
odatelayer.tmpSelectMonthLayer.style.display="";192
odatelayer.tmpSelectMonthLayer.innerHTML = selectInnerHTML;193
odatelayer.tmpSelectMonth.focus();194
}195
function closeLayer(){196
document.all.meizzDateLayer.style.display="none";197
}198
function IsPinYear(year){199
if (0==year%4&&((year%100!=0)||(year%400==0))) return true;else return false;200
}201
function GetMonthCount(year,month){202
var c=MonHead[month-1];if((month==2)&&IsPinYear(year)) c++;return c;203
}204
function GetDOW(day,month,year){205
var dt=new Date(year,month-1,day).getDay()/7; return dt;206
}207
function meizzPrevY(){208
if(meizzTheYear > 999 && meizzTheYear <10000){meizzTheYear--;}209
else{alert("年份超出范围(1000-9999)!");}210
meizzSetDay(meizzTheYear,meizzTheMonth);211
}212
function meizzNextY(){213
if(meizzTheYear > 999 && meizzTheYear <10000){meizzTheYear++;}214
else{alert("年份超出范围(1000-9999)!");}215
meizzSetDay(meizzTheYear,meizzTheMonth);216
}217
function meizzToday(){218
var today;219
meizzTheYear = new Date().getFullYear();220
meizzTheMonth = new Date().getMonth()+1;221
today=new Date().getDate();222
if(outObject){223
outObject.value=meizzTheYear + "-" + meizzTheMonth + "-" + today;224
}225
closeLayer();226
}227

228
//added by wayne 050816229
//ClearDate230
function ClearDate(){231
if(outObject){232
outObject.value="";233
}234
closeLayer();235
}236

237
function meizzPrevM(){238
if(meizzTheMonth>1){meizzTheMonth--}else{meizzTheYear--;meizzTheMonth=12;}239
meizzSetDay(meizzTheYear,meizzTheMonth);240
}241
function meizzNextM(){242
if(meizzTheMonth==12){meizzTheYear++;meizzTheMonth=1}else{meizzTheMonth++}243
meizzSetDay(meizzTheYear,meizzTheMonth);244
}245
function meizzSetDay(yy,mm){246
meizzWriteHead(yy,mm);247
meizzTheYear=yy;248
meizzTheMonth=mm;249
for (var i = 0; i < 39; i++){meizzWDay[i]=""}; 250
var day1 = 1,day2=1,firstday = new Date(yy,mm-1,1).getDay();251
for (i=0;i<firstday;i++)meizzWDay[i]=GetMonthCount(mm==1?yy-1:yy,mm==1?12:mm-1)-firstday+i+1252
for (i = firstday; day1 < GetMonthCount(yy,mm)+1; i++){meizzWDay[i]=day1;day1++;}253
for (i=firstday+GetMonthCount(yy,mm);i<39;i++){meizzWDay[i]=day2;day2++}254
for (i = 0; i < 39; i++)255
{ var da = eval("odatelayer.meizzDay"+i)256
if (meizzWDay[i]!=""){ 257
da.borderColorLight="#76A0CF";258
da.borderColorDark="#76A0CF";259
if(i<firstday){260
da.innerHTML="<font style=' color: #B5C5D2;'>" + meizzWDay[i] + "</font>";261
da.title=(mm==1?12:mm-1) +"月" + meizzWDay[i] + "日";262
da.onclick=Function("meizzDayClick(this.innerText,-1)");263
if(!outDate)264
da.style.backgroundColor = ((mm==1?yy-1:yy) == new Date().getFullYear() && 265
(mm==1?12:mm-1) == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate()) ?266
"#E4E3F2":"#FFFFFF";267
else{268
da.style.backgroundColor =((mm==1?yy-1:yy)==outDate.getFullYear() && (mm==1?12:mm-1)== outDate.getMonth() + 1 && 269
meizzWDay[i]==outDate.getDate())? "#E8F5E7" : 270
(((mm==1?yy-1:yy) == new Date().getFullYear() && (mm==1?12:mm-1) == new Date().getMonth()+1 && 271
meizzWDay[i] == new Date().getDate()) ? "#E4E3F2":"#FFFFFF"); 272
if((mm==1?yy-1:yy)==outDate.getFullYear() && (mm==1?12:mm-1)== outDate.getMonth() + 1 && 273
meizzWDay[i]==outDate.getDate())274
{}275
}276
}277
else if (i>=firstday+GetMonthCount(yy,mm)){278
da.innerHTML="<font style=' color: #B5C5D2;'>" + meizzWDay[i] + "</font>";279
da.title=(mm==12?1:mm+1) +"月" + meizzWDay[i] + "日";280
da.onclick=Function("meizzDayClick(this.innerText,1)");281
if(!outDate)282
da.style.backgroundColor = ((mm==12?yy+1:yy) == new Date().getFullYear() && 283
(mm==12?1:mm+1) == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate()) ?284
"#E4E3F2":"#FFFFFF";285
else{286
da.style.backgroundColor =((mm==12?yy+1:yy)==outDate.getFullYear() && (mm==12?1:mm+1)== outDate.getMonth() + 1 && 287
meizzWDay[i]==outDate.getDate())? "#E8F5E7" : 288
(((mm==12?yy+1:yy) == new Date().getFullYear() && (mm==12?1:mm+1) == new Date().getMonth()+1 && 289
meizzWDay[i] == new Date().getDate()) ? "#E4E3F2":"#FFFFFF"); 290
if((mm==12?yy+1:yy)==outDate.getFullYear() && (mm==12?1:mm+1)== outDate.getMonth() + 1 && 291
meizzWDay[i]==outDate.getDate()){292
da.borderColorLight="#E4E3F2";293
da.borderColorDark="#E4E3F2"; 294
}295
}296
}297
else{298
da.innerHTML="<font style=' color: #3E5468;'>" + meizzWDay[i] + "</FONT>";299
da.title=mm +"月" + meizzWDay[i] + "日";300
da.onclick=Function("meizzDayClick(this.innerText,0)");301
if(!outDate)302
da.style.backgroundColor = (yy == new Date().getFullYear() && mm == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate())?303
"#FFFFFF":"#FFFFFF";304
else{305
da.style.backgroundColor =(yy==outDate.getFullYear() && mm== outDate.getMonth() + 1 && meizzWDay[i]==outDate.getDate())?306
"#D5ECD2":((yy == new Date().getFullYear() && mm == new Date().getMonth()+1 && meizzWDay[i] == new Date().getDate())?307
"#E4E3F2":"#F8F8FC"); 308
}309
}310
da.style.cursor="hand"311
da.onmouseover=Function("this.backgroundColor='#000000';this.borderColorDark='#000099';this.borderColorLight='#000099';");312
da.onmouseout=Function("this.bgColor='#000000';this.borderColorDark='#9CBADE';this.borderColorLight='#9CBADE';");313
}314
else{da.innerHTML="";da.style.backgroundColor="";da.style.cursor="default";da.onmouseover=Function("this.backgroundColor='#000000';this.borderColorDark='#000099';this.borderColorLight='#000099';");315
da.onmouseout=Function("this.bgColor='#000000';this.borderColorDark='#9CBADE';this.borderColorLight='#9CBADE';");}316
}}317
function meizzDayClick(n,ex){318
var yy=meizzTheYear;319
var mm = parseInt(meizzTheMonth)+ex; 320
if(mm<1){321
yy--;322
mm=12+mm;323
}324
else if(mm>12){325
yy++;326
mm=mm-12;327
}328
if (mm < 10){mm = "0" + mm;}329
if (outObject){330
if (!n) { 331
return;}332
if ( n < 10){n = "0" + n;}333
outObject.value= yy + "-" + mm + "-" + n ;334
closeLayer();335
outObject.onchange();336
}337
else {closeLayer(); alert("您所要输出的控件对象并不存在!");}338
}339
//-->
<!--.aspx文件中的调用方法//-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>
<asp:Literal id="PageTitle" runat="server"></asp:Literal></title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="../Styles/EasyStyle.css" type="text/css" rel="stylesheet">
<script language="javascript" src="../Scripts/EasyDate.js"></script>
</HEAD>
<body class="BodyStyle" MS_POSITIONING="GridLayout">
<asp:textbox id="txtEndDate" style="CURSOR: hand" onfocus="setday(this);" runat="server" CssClass="allborderW" Width="75px" ReadOnly="True">



strFrame
浙公网安备 33010602011771号