共公部分
css:
body
{...}
{font-family: verdana;font-size: 9pt;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
table
{...}
{font-family: verdana;font-size: 9pt;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
a
{...}
{font-family: verdana;font-size: 9pt;color: blue;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.table_a
{...}
{border: #bababa 1px solid;border-top: White 0px solid;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.table_b
{...}
{border-left: #bababa 1px solid;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.table_c
{...}
{border: #bababa 1px solid;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.table_d
{...}
{border-bottom:#bababa 1px solid;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.td_a
{...}
{background:url(../images/qq.gif);background-repeat:repeat-x;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.td_b
{...}
{border-right: #bababa 1px solid; width:150px;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.button_a
{...}
{cursor: hand;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.h1
{...}
{font-family: verdana;font-weight: normal;font-size: 9pt;color:blue;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.h1_1
{...}
{font-family: verdana;font-weight: normal;font-size: 9pt;color:black;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.h2
{...}
{font-family: verdana;font-weight: normal;font-size: 9pt;color:red;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.h2_2
{...}
{font-family: verdana;font-weight: normal;font-size: 9pt;color:green;}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.h3
{...}
{font-family: verdana;font-weight: bold;font-size: 10pt;}
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
.bsdate_frame
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
{...}
{
BORDER-RIGHT: black 1px;
BORDER-TOP: black 1px;
FONT-WEIGHT: normal;
FONT-SIZE: 9pt;
BORDER-LEFT: black 1px;
LINE-HEIGHT: normal;
BORDER-BOTTOM: black 1px;
FONT-STYLE: normal;
BACKGROUND-COLOR: transparent;
FONT-VARIANT: normal
}
.bsdate_input
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
{...}
{
BORDER-RIGHT: 0px;
BORDER-TOP: 0px;
FONT-WEIGHT: normal;
FONT-SIZE: 9pt;
BORDER-LEFT: 0px;
COLOR: blue;
LINE-HEIGHT: normal;
BORDER-BOTTOM: 0px;
FONT-STYLE: normal;
BACKGROUND-COLOR: transparent;
TEXT-ALIGN: right;
FONT-VARIANT: normal
}
.bsdate_des
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
{...}
{
BACKGROUND-COLOR: transparent
FONT-SIZE: 12px;
FONT-FAMILY: 宋体;
}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.bsdate_btn
{...}
{
COLOR: #000000;
TEXT-DECORATION: none;
cursor:hand;
}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
.bsdate_mhdes
{...}
{
BACKGROUND-COLOR: transparent
FONT-WEIGHT: bold;
font-family:Fixedsys;
FONT-SIZE: 9pt;
}
公共方法:
function
GetDefineX(ObjectID)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
var iPositionX=ObjectID.offsetLeft;
while(ObjectID=ObjectID.offsetParent)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
iPositionX+=ObjectID.offsetLeft-ObjectID.scrollLeft;
}
return iPositionX;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
function
GetDefineY(ObjectID)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
var iPositionY=ObjectID.offsetTop;
while(ObjectID=ObjectID.offsetParent)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
iPositionY+=ObjectID.offsetTop-ObjectID.scrollTop;
}
return iPositionY;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
String.prototype.Trim
=
function
()
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
return this.replace(/(^s*)|(s*$)/g, "");
}
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
String.prototype.LTrim
=
function
()
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
return this.replace(/(^s*)/g, "");
}
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
String.prototype.RTrim
=
function
()
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
return this.replace(/(s*$)/g, "");
}
var
BSPopup
=
window.createPopup();
BSDate.cl_resClickLater
=
'
请在页面显示完了之后,再点击。
'
;
BSDate.cl_resDateDrop
=
'
▼
'
;
BSDate.cl_resDateTitle
=
'
选择日期
'
;
BSDate.cl_resDateUp
=
'
▲
'
;
BSDate.cl_resDay
=
'
日
'
;
BSDate.cl_resMonth
=
'
月
'
;
BSDate.cl_resMonth1
=
'
一月
'
;
BSDate.cl_resMonth10
=
'
十月
'
;
BSDate.cl_resMonth11
=
'
十一月
'
;
BSDate.cl_resMonth12
=
'
十二月
'
;
BSDate.cl_resMonth2
=
'
二月
'
;
BSDate.cl_resMonth3
=
'
三月
'
;
BSDate.cl_resMonth4
=
'
四月
'
;
BSDate.cl_resMonth5
=
'
五月
'
;
BSDate.cl_resMonth6
=
'
六月
'
;
BSDate.cl_resMonth7
=
'
七月
'
;
BSDate.cl_resMonth8
=
'
八月
'
;
BSDate.cl_resMonth9
=
'
九月
'
;
BSDate.cl_resMonthNext
=
'
下月
'
;
BSDate.cl_resMonthNextBtn
=
'
》
'
;
BSDate.cl_resMonthPrev
=
'
上月
'
;
BSDate.cl_resMonthPrevBtn
=
'
《
'
;
BSDate.cl_resWeek1
=
'
一
'
;
BSDate.cl_resWeek2
=
'
二
'
;
BSDate.cl_resWeek3
=
'
三
'
;
BSDate.cl_resWeek4
=
'
四
'
;
BSDate.cl_resWeek5
=
'
五
'
;
BSDate.cl_resWeek6
=
'
六
'
;
BSDate.cl_resWeek7
=
'
日
'
;
BSDate.cl_resYear
=
'
年
'
;
BSDate.dateHTML
=
""
;
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
BSDate.m_iDatePickerCount
=
0
;
BSDate.cl_dpMaxYear
=
2150
;
BSDate.cl_dpMaxMonth
=
11
;
BSDate.cl_dpMaxDay
=
31
;
BSDate.cl_dpMinYear
=
1901
;
BSDate.cl_dpMinMonth
=
0
;
BSDate.cl_dpMinDay
=
1
;
BSPopup_style_title
=
"
FONT-WEIGHT: normal;FONT-SIZE: 9pt;COLOR: #fffacd;background-COLOR: #00008b;
"
;
BSPopup_style_frameinput
=
"
height:18px;width:15px;BORDER: black 0px solid;FONT-WEIGHT: normal;FONT-SIZE: 9pt;black: blue;LINE-HEIGHT: normal;FONT-STYLE: normal;background-COLOR: transparent;Text-ALIGN: right;FONT-VARIANT: normal;
"
;
BSPopup_style_framebtn
=
"
BORDER-RIGHT: black 1px solid;border-TOP: white 1px solid;FONT-WEIGHT: normal;FONT-SIZE: 9pt;border-LEFT: white 1px solid;width: 16px;COLOR: blue;LINE-HEIGHT: normal;border-BOTTOM: black 1px solid;FONT-STYLE: normal;background-COLOR: silver;FONT-VARIANT: normal;
"
;
BSPopup_style_framebtnOK
=
"
BORDER-RIGHT: black 1px solid;border-TOP: white 1px solid;FONT-WEIGHT: normal;FONT-SIZE: 9pt;border-LEFT: white 1px solid;width: 30px;COLOR: blue;LINE-HEIGHT: normal;border-BOTTOM: black 1px solid;FONT-STYLE: normal;background-COLOR: silver;FONT-VARIANT: normal;
"
;
BSPopup_style_framebtnOK2
=
"
background-COLOR: silver;BORDER-RIGHT: black 1px solid;border-TOP: white 1px solid;width: 16px;border-LEFT: white 1px solid;border-BOTTOM: black 1px solid;height: 8px;font-family:Webdings;font-size: 7px;line-height: 2px;padding-left: 2px;cursor: default;
"
;
BSPopup_style_weekname
=
"
FONT-WEIGHT: normal;COLOR: #00008b;LINE-HEIGHT: normal;BORDER-BOTTOM: black 1px solid;FONT-SIZE: 9pt;FONT-STYLE: normal;TEXT-ALIGN: center;FONT-VARIANT: normal;
"
;
BSPopup_style_table
=
"
BORDER-TOP: lightgrey 1px solid;BORDER-LEFT: lightgrey 1px solid;CURSOR: default;BORDER-right: black 1px solid;BORDER-BOTTOM: black 1px solid;POSITION: absolute;BACKGROUND-COLOR: #ffffff;
"
;
BSPopup_style_DPCellOther
=
"
FONT-WEIGHT: normal;FONT-SIZE: 9pt;CURSOR: hand;COLOR: silver;LINE-HEIGHT: normal;FONT-STYLE: normal;TEXT-ALIGN: center;FONT-VARIANT: normal;
"
;
BSPopup_style_DPCell
=
"
FONT-WEIGHT: normal;FONT-SIZE: 9pt;CURSOR: hand;COLOR: #00008b;LINE-HEIGHT: normal;FONT-STYLE: normal;TEXT-ALIGN: center;FONT-VARIANT: normal;
"
;
BSPopup_style_DPCellSelect
=
"
FONT-WEIGHT: normal;FONT-SIZE: 9pt;CURSOR: hand;COLOR: #000000;LINE-HEIGHT: normal;FONT-STYLE: normal;TEXT-ALIGN: center;FONT-VARIANT: normal;BACKGROUND-COLOR: #ffa07a;
"
;
function
KeyFilter(type)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
var berr=false;
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
switch(type)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
case 'date':
if (!(event.keyCode == 45 || event.keyCode == 47 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
case 'number':
if (!(event.keyCode>=48 && event.keyCode<=57))
berr=true;
break;
case 'cy':
if (!(event.keyCode == 46 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
case 'long':
if (!(event.keyCode == 45 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
case 'double':
if (!(event.keyCode == 45 || event.keyCode == 46 || (event.keyCode>=48 && event.keyCode<=57)))
berr=true;
break;
default:
if (event.keyCode == 35 || event.keyCode == 37 || event.keyCode==38)
berr=true;
}
return !berr;
}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
function
dateCompare(thisDt, dtCompare)
...
{
var hr = -1;
if(thisDt && dtCompare)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
if(thisDt.getFullYear()>dtCompare.getFullYear())
hr=1;
else if(thisDt.getFullYear()<dtCompare.getFullYear())
hr=-1;
else if(thisDt.getMonth()>dtCompare.getMonth())
hr=1;
else if(thisDt.getMonth()<dtCompare.getMonth())
hr=-1;
else if(thisDt.getDate()>dtCompare.getDate())
hr=1;
else if(thisDt.getDate()<dtCompare.getDate())
hr=-1;
}
return hr;
}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
function
dateFormat(dt, sFormat)
...
{
if(sFormat==null || typeof(sFormat)!="string")
sFormat="";
sFormat=sFormat.replace(/yyyy/ig,dt.getFullYear());
var y=""+dt.getYear();
if(y.length>2)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
y=y.substring(y.length-2,y.length);
}
sFormat=sFormat.replace(/yy/ig,y);
var temp = dt.getMonth()+1;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (temp < 10)...{
temp = "0"+temp;
}
sFormat=sFormat.replace(/mm/ig,temp);
temp = dt.getDate();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (temp < 10)...{
temp = "0"+temp;
}
sFormat=sFormat.replace(/dd/ig,temp);
temp = dt.getHours();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (temp < 10)...{
temp = "0"+temp;
}
sFormat=sFormat.replace(/hh24/ig,temp);
temp = dt.getMinutes();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (temp < 10)...{
temp = "0"+temp;
}
sFormat=sFormat.replace(/mi/ig,temp);
sFormat=sFormat.replace(/ss/ig,"00");
return sFormat;
}
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
function
StringToDate(inStr)
...
{
var dt = new Date();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (inStr != null && inStr != "")...{
var dList = null;
var tList = null;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (inStr.indexOf(' ') < 1)...{
dList = inStr.split('-');
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else...{
dList = (inStr.substring(0, inStr.indexOf(' '))).split('-');
tList = (inStr.substring(inStr.indexOf(' ')+1, inStr.length)).split(':');
}
dt.setYear(dList[0]);
dt.setMonth(dList[1]-1);
dt.setDate(dList[2]);
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (tList != null)...{
dt.setHours(tList[0]);
dt.setMinutes(tList[1]);
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else...{
dt.setHours(0);
dt.setMinutes(0);
}
}
return dt;
}
BSDate:
/**
* <p>标题: BSDate</p>
* <p>功能描述: BS日期对象。装载所有的日期</p>
* <p>作者: BinaryStar原创B/S框架</p>
* <p>版本: 0.1</p>
* <p>创建日期: 2005-12-21</p>
*/
function
BSDate(name, elmName, readonly, showTime)
...
{
this.name = name || "bsDate";//日期对象实例
this.readonly = readonly || false;//只读标志
this.elmName = elmName || "bsDateObj";//装载日期控件的文本框名称
this.showTime;//显示时间,false:不显示;true:显示,缺省为true;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (showTime == null)...{
this.showTime = true;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else...{
this.showTime = showTime;
}
this.bsdate = new Date();
//得到日期名称
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.getMonthName = function(lMonth)...{
var mnArr=new Array(BSDate.cl_resMonth1,BSDate.cl_resMonth2,BSDate.cl_resMonth3,BSDate.cl_resMonth4,BSDate.cl_resMonth5,BSDate.cl_resMonth6,
BSDate.cl_resMonth7,BSDate.cl_resMonth8,BSDate.cl_resMonth9,BSDate.cl_resMonth10,BSDate.cl_resMonth11,BSDate.cl_resMonth12);
return mnArr[lMonth];
}
//得到日期对象
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.getDateObj = function ()...{
return this.bsdate;
}
//得到日期字符串
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.getDateStr = function ()...{
return document.getElementById(this.elmName).value;
}
//初始化或修改日期时间
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.updateDateTime = function(dt, lYear, lMonth, lDay, lHours, lMins)...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
return;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (dt == null)...{
lYear=parseInt(lYear,10);
lMonth=parseInt(lMonth,10);
lDay=parseInt(lDay,10);
lHours=parseInt(lHours,10);
lMins=parseInt(lMins,10);
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(!(isNaN(lYear) || isNaN(lMonth) || isNaN(lDay) || isNaN(lHours) || isNaN(lMins)))...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lYear<=BSDate.cl_dpMinYear)...{
lYear = BSDate.cl_dpMinYear;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else if (lYear>=BSDate.cl_dpMaxYear)...{
lYear = BSDate.cl_dpMaxYear;
}
this.bsdate.setYear(lYear);
this.bsdate.setMonth(lMonth-1);
this.bsdate.setDate(lDay);
this.bsdate.setHours(lHours);
this.bsdate.setMinutes(lMins);
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else...{
this.bsdate = dt;
}
this.setInputDate();
}
//初始化或修改日期
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.updateDate = function(lYear, lMonth, lDay)...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
return;
}
lYear=parseInt(lYear,10);
lMonth=parseInt(lMonth,10);
lDay=parseInt(lDay,10);
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(!(isNaN(lYear) || isNaN(lMonth) || isNaN(lDay)))...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lYear<=BSDate.cl_dpMinYear)...{
lYear = BSDate.cl_dpMinYear;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else if (lYear>=BSDate.cl_dpMaxYear)...{
lYear = BSDate.cl_dpMaxYear;
}
this.bsdate.setYear(lYear);
this.bsdate.setMonth(lMonth-1);
this.bsdate.setDate(lDay);
}
this.setInputDate();
}
//初始化或修改时间
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.updateTime = function(lHours, lMins)...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
return;
}
lHours=parseInt(lHours,10);
lMins=parseInt(lMins,10);
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(!(isNaN(lHours) || isNaN(lMins)))...{
this.bsdate.setHours(lHours);
this.bsdate.setMinutes(lMins);
}
this.setInputDate();
}
//设置只读标志
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.setReadonly = function(readonly)...{
this.readonly = readonly || false;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (document.getElementById(this.elmName) != null)...{
var col = "black";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
col = "silver";
}
document.getElementById(this.name+"_input_year").readOnly = this.readonly;
document.getElementById(this.name+"_input_month").readOnly = this.readonly;
document.getElementById(this.name+"_input_day").readOnly = this.readonly;
document.getElementById(this.name+"_input_hour").readOnly = this.readonly;
document.getElementById(this.name+"_input_min").readOnly = this.readonly;
document.getElementById(this.name+"_btn").style.color = col;
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//设置时间显示标志
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.setTimeShow = function(showTime)...{
this.showTime = showTime || false;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (document.getElementById(this.elmName) != null)...{
var col = "none";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.showTime)...{
col = "";
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
var stformt="yyyy-mm-dd hh24:mi:ss";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (!this.showTime)...{
stformt = "yyyy-mm-dd";
}
document.getElementById(this.name+"_input_hour").style.display = col;
document.getElementById(this.name+"_input_mh").style.display = col;
document.getElementById(this.name+"_input_min").style.display = col;
document.getElementById(this.elmName).value = dateFormat(this.bsdate, stformt);
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.setDateHTML = function()...{
this.setInputDate();
var dt = new Date(this.bsdate.getFullYear(),this.bsdate.getMonth(),1);
var tempDt=new Date(this.bsdate.getFullYear(),this.bsdate.getMonth(),1-dt.getDay());
BSDate.dateHTML = "<TABLE style=""+BSPopup_style_table+"" id="dpDropDownTable" align="center" CELLSPACING="0" border=0>";
BSDate.dateHTML += "<TR style=""+BSPopup_style_title+"" onselectstart="event.cancelBubble=true;window.event.returnValue=false;">";
BSDate.dateHTML += "<TD align="center"><span style=""+BSPopup_style_framebtn+"" οnclick="parent."+this.name+".changeMonth(event, true);" title=""+BSDate.cl_resMonthPrev+"">"+BSDate.cl_resMonthPrevBtn+"<span></TD>";
BSDate.dateHTML += "<TD align="center" colspan="5">"+this.getMonthName(this.bsdate.getMonth())+" "+this.bsdate.getFullYear()+"</TD>";
BSDate.dateHTML += "<TD align="center"><span style=""+BSPopup_style_framebtn+"" οnclick="parent."+this.name+".changeMonth(event, false);" title=""+BSDate.cl_resMonthNext+"">"+BSDate.cl_resMonthNextBtn+"<span></TD>";
BSDate.dateHTML += "</TR>";
BSDate.dateHTML += "<TR onselectstart="event.cancelBubble=true;window.event.returnValue=false;">";
BSDate.dateHTML += "<TD align="center" style=""+BSPopup_style_weekname+""> "+BSDate.cl_resWeek7+" </TD>";
BSDate.dateHTML += "<TD align="center" style=""+BSPopup_style_weekname+""> "+BSDate.cl_resWeek1+" </TD>";
BSDate.dateHTML += "<TD align="center" style=""+BSPopup_style_weekname+""> "+BSDate.cl_resWeek2+" </TD>";
BSDate.dateHTML += "<TD align="center" style=""+BSPopup_style_weekname+""> "+BSDate.cl_resWeek3+" </TD>";
BSDate.dateHTML += "<TD align="center" style=""+BSPopup_style_weekname+""> "+BSDate.cl_resWeek4+" </TD>";
BSDate.dateHTML += "<TD align="center" style=""+BSPopup_style_weekname+""> "+BSDate.cl_resWeek5+" </TD>";
BSDate.dateHTML += "<TD align="center" style=""+BSPopup_style_weekname+""> "+BSDate.cl_resWeek6+" </TD>";
BSDate.dateHTML += "</TR>";
//显示日期
var day=tempDt.getDate();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
for(var i=2; i<8; i++)...{
BSDate.dateHTML += "<TR onselectstart="event.cancelBubble=true;window.event.returnValue=false;">";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
for(var j=0; j<7; j++)...{
BSDate.dateHTML += "<TD ";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(tempDt.getMonth()!=this.bsdate.getMonth())...{
BSDate.dateHTML += "style=""+BSPopup_style_DPCellOther+"" ";
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else if (tempDt.getDate()!=this.bsdate.getDate())...{
BSDate.dateHTML += "style=""+BSPopup_style_DPCell+"" ";
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else...{
BSDate.dateHTML += "style=""+BSPopup_style_DPCellSelect+"" ";
}
var onchangfun = "parent."+this.name+".changeDay(event, "+tempDt.getFullYear()+", "+tempDt.getMonth()+", "+day+");return false;";
BSDate.dateHTML += (" οnclick=""+onchangfun+"" ");
BSDate.dateHTML += (" onDblClick="alert('aa')"");
BSDate.dateHTML += ">"+day+"</TD>";
tempDt.setDate(day+1);
day=tempDt.getDate();
}
BSDate.dateHTML += "</TR>";
}
BSDate.dateHTML += "<TR><TD colspan="7" style="BORDER-TOP: black 1px solid;width:100%;height:20px;" valign="top">";
BSDate.dateHTML += "<TABLE style="width:100%;height:25px;">";
BSDate.dateHTML += "<TR>";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.showTime)...{
BSDate.dateHTML += "<TD style="width:15;height:20px;"><span style=""+BSPopup_style_frameinput+"">"+this.bsdate.getHours()+"</span></TD>";
BSDate.dateHTML += "<TD style="width:16px;FONT-SIZE: 9pt;FONT-WEIGHT: normal;" valign="top">";
BSDate.dateHTML += "<input type="button" onFocus="this.blur();" style=""+BSPopup_style_framebtnOK2+"" οnclick="parent."+this.name+".changeHour(event, 1)" id="BSPopup_H_A" value="5"/><br/>";
BSDate.dateHTML += "<input type="button" onFocus="this.blur();" style=""+BSPopup_style_framebtnOK2+"" οnclick="parent."+this.name+".changeHour(event, -1)" id="BSPopup_H_D" value="6"/>";
BSDate.dateHTML += "<TD style="width:12px;FONT-SIZE: 9pt;FONT-WEIGHT: normal;">时</TD>";
BSDate.dateHTML += "<TD style="width:15;height:20px;"><span style=""+BSPopup_style_frameinput+"">"+this.bsdate.getMinutes()+"</span></TD>";
BSDate.dateHTML += "<TD style="width:16px;FONT-SIZE: 9pt;FONT-WEIGHT: normal;" valign="top">";
BSDate.dateHTML += "<input type="button" onFocus="this.blur();" style=""+BSPopup_style_framebtnOK2+"" οnclick="parent."+this.name+".changeMin(event, 1)" value="5"/><br/>";
BSDate.dateHTML += "<input type="button" onFocus="this.blur();" style=""+BSPopup_style_framebtnOK2+"" οnclick="parent."+this.name+".changeMin(event, -1)" value="6"/>";
BSDate.dateHTML += "<TD style="width:100%;FONT-SIZE: 9pt;FONT-WEIGHT: normal;" align="left">分</TD>";
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else...{
BSDate.dateHTML += "<TD style="width:100%;FONT-SIZE: 9pt;FONT-WEIGHT: normal;" align="left"> </TD>";
}
BSDate.dateHTML += "<TD style="height:20px;" valign="top"><input type="button" tabindex="2" οnclick="parent."+this.name+".toDay(event)" style=""+BSPopup_style_framebtnOK+";height:18px;" value="今天"/></TD>";
BSDate.dateHTML += "<TD style="height:20px;" valign="top"><input id="BSPopup_OKbtn" tabindex="1" type="button" οnclick="parent.BSPopup.hide();" style=""+BSPopup_style_framebtnOK+";height:18px;" value="确定"/></TD>";
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
BSDate.dateHTML += "</TR>";
BSDate.dateHTML += "</TABLE>";
BSDate.dateHTML += "</TD></TR>";
BSDate.dateHTML += "</TABLE>";
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//展现日期控件
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.show = function(type)...{
var lYear=this.bsdate.getFullYear();
var lMonth=this.bsdate.getMonth()+1;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lMonth < 10)...{
lMonth = "0"+lMonth;
}
var lDay=this.bsdate.getDate();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lDay < 10)...{
lDay = "0"+lDay;
}
var lHours=this.bsdate.getHours();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lHours < 10)...{
lHours = "0"+lHours;
}
var lMins=this.bsdate.getMinutes();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lMins < 10)...{
lMins = "0"+lMins;
}
var ro = "", rosty="";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
ro = " readonly="readonly"";
rosty="color:silver;";
}
var st = "",stformt="yyyy-mm-dd hh24:mi:ss";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (!this.showTime)...{
st = "display:none;";
stformt = "yyyy-mm-dd";
}
var tempHTML = "<span class="bsdate_frame" id=""+this.name+"_frame" name=""+this.name+"_frame">";
tempHTML += "<nobr>";
tempHTML += "<input id=""+this.name+"_input_year" class="bsdate_input" style="width:30px" type="text" value=""+lYear+"" size="3" maxlength="4" οnfοcus="return "+this.name+".dateFocus('year')" οnblur="return "+this.name+".dateBlur('year')" οnkeypress="return KeyFilter('number');" οnkeydοwn="return "+this.name+".keyDown('year')""+ro+"/>";
tempHTML += "<font class="bsdate_des">"+BSDate.cl_resYear+"</font>";
tempHTML += "<input id=""+this.name+"_input_month" class="bsdate_input" style="width:15px" type="text" value=""+lMonth+"" size="1" maxlength="2" οnfοcus="return "+this.name+".dateFocus('month')" οnblur="return "+this.name+".dateBlur('month')" οnkeypress="return KeyFilter('number');" οnkeydοwn="return "+this.name+".keyDown('month')""+ro+"/>";
tempHTML += "<font class="bsdate_des">"+BSDate.cl_resMonth+"</font>";
tempHTML += "<input id=""+this.name+"_input_day" class="bsdate_input" style="width:15px" type="text" value=""+lDay+"" size="1" maxlength="2" οnfοcus="return "+this.name+".dateFocus('day')" οnblur="return "+this.name+".dateBlur('day')" οnkeypress="return KeyFilter('number');" οnkeydοwn="return "+this.name+".keyDown('day')""+ro+"/>";
tempHTML += "<font class="bsdate_des">"+BSDate.cl_resDay+"</font>";
tempHTML += "<input id=""+this.name+"_input_hour" class="bsdate_input" style="width:15px;"+st+"" type="text" value=""+lHours+"" size="1" maxlength="2" οnfοcus="return "+this.name+".dateFocus('hour')" οnblur="return "+this.name+".dateBlur('hour')" οnkeypress="return KeyFilter('number');" οnkeydοwn="return "+this.name+".keyDown('hour')""+ro+"/>";
tempHTML += "<font id=""+this.name+"_input_mh" class="bsdate_mhdes" style=""+st+"">:</font>";
tempHTML += "<input id=""+this.name+"_input_min" class="bsdate_input" style="width:15px;"+st+"" type="text" value=""+lMins+"" size="1" maxlength="2" οnfοcus="return "+this.name+".dateFocus('min')" οnblur="return "+this.name+".dateBlur('min')" οnkeypress="return KeyFilter('number');" οnkeydοwn="return "+this.name+".keyDown('min')""+ro+"/>";
tempHTML += "<span class="bsdate_btn" id=""+this.name+"_btn" name=""+this.name+"_btn" οnclick=""+this.name+".showDig(this);return false;" title=""+BSDate.cl_resDateTitle+"" style=""+rosty+"">"+BSDate.cl_resDateDrop+"</span>";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(typeof(this.name)=="string" && this.name.length>0)...{
tempHTML += "<input type="hidden" value=""+dateFormat(this.bsdate, stformt)+"" id=""+this.elmName+"" name=""+this.elmName+""/>";
}
tempHTML += "</nobr>";
tempHTML += "</span>";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (type == null || type)...{
document.write(tempHTML);
}
return tempHTML;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//打开下拉列表框
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.showDig = function(inObjID)...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
return;
}
var left = 128;
this.setDateHTML();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (!this.showTime)...{
left = 90;
}
BSPopup.document.body.innerHTML=BSDate.dateHTML;
BSPopup.show(GetDefineX(inObjID)-left, GetDefineY(inObjID)+14, 184, 162, document.body);
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//设置显示日期内容
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.setInputDate = function()...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (document.getElementById(this.elmName) != null)...{
var lYear=this.bsdate.getFullYear();
var lMonth=this.bsdate.getMonth()+1;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lMonth < 10)...{
lMonth = "0"+lMonth;
}
var lDay=this.bsdate.getDate();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lDay < 10)...{
lDay = "0"+lDay;
}
var lHours=this.bsdate.getHours();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lHours < 10)...{
lHours = "0"+lHours;
}
var lMins=this.bsdate.getMinutes();
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (lMins < 10)...{
lMins = "0"+lMins;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
var stformt="yyyy-mm-dd hh24:mi:ss";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (!this.showTime)...{
stformt = "yyyy-mm-dd";
}
document.getElementById(this.name+"_input_year").value = lYear;
document.getElementById(this.name+"_input_month").value = lMonth;
document.getElementById(this.name+"_input_day").value = lDay;
document.getElementById(this.name+"_input_hour").value = lHours;
document.getElementById(this.name+"_input_min").value = lMins;
document.getElementById(this.elmName).value = dateFormat(this.bsdate, stformt);
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//输入框失去焦点
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.dateBlur = function(srcType)...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
return true;
}
var src=event.srcElement;
var lYear=this.bsdate.getFullYear();
var lMonth=this.bsdate.getMonth()+1;
var lDay=this.bsdate.getDate();
var lHours=this.bsdate.getHours();
var lMins=this.bsdate.getMinutes();
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
var val=parseInt(src.value,10);
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(isNaN(val))...{
val=-1;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
switch(srcType) ...{
case 'year':
lYear=val==-1?lYear:val;
break;
case 'month':
lMonth=val==-1?lMonth:val;
break;
case 'day':
lDay=val==-1?lDay:val;
break;
case 'hour':
lHours=val==-1?lHours:val;
break;
case 'min':
lMins=val==-1?lMins:val;
break;
default:break;
}
this.setCurDate(lYear, lMonth, lDay, lHours, lMins);
return true;
}
//输入框聚焦
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.dateFocus = function (srcType)...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
return true;
}
var src=event.srcElement;
if(src && src.tagName=="INPUT")
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
switch(srcType)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
case 'year':
break;
case 'month':
break;
case 'day':
break;
case 'hour':
break;
case 'min':
break;
default:;
}
src.select();
}
return true;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//上下箭头改变文本框内容
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.keyDown = function (srcType)...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (this.readonly)...{
return true;
}
var bRefresh=true;
var src=event.srcElement;
var lYear=this.bsdate.getFullYear();
var lMonth=this.bsdate.getMonth();
var lDay=this.bsdate.getDate();
var lHours=this.bsdate.getHours();
var lMins=this.bsdate.getMinutes();
var lStep=0;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
switch(event.keyCode)...{
case 38://上箭头
lStep=1;
break;
case 40://下箭头
lStep=-1;
break;
case 13://回车
event.keyCode=9;//Tab
bRefresh=false;
break;
default:bRefresh=false;break;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
switch(srcType) ...{
case 'year':
lYear+=lStep;
break;
case 'month':
lMonth+=lStep;
break;
case 'day':
lDay+=lStep;
break;
case 'hour':
lHours+=lStep;
break;
case 'min':
lMins+=lStep;
break;
default:break;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(bRefresh)...{
this.setCurDate(lYear, lMonth+1, lDay, lHours, lMins);
//alert("keyDown:"+lMonth);
}
return true;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//设置修改后的时间
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.setCurDate = function(lYear, lMonth, lDay, lHours, lMins)...{
var hr=false;
lYear=parseInt(lYear,10);
lMonth=parseInt(lMonth,10);
lDay=parseInt(lDay,10);
lHours=parseInt(lHours,10);
lMins=parseInt(lMins,10);
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(!(isNaN(lYear) || isNaN(lMonth) || isNaN(lDay) || isNaN(lHours) || isNaN(lHours)))...{
var dt=new Date(lYear, lMonth-1 , lDay, lHours, lMins);
var dMax=new Date(BSDate.cl_dpMaxYear,BSDate.cl_dpMaxMonth,BSDate.cl_dpMaxDay,23,59);
var dMin=new Date(BSDate.cl_dpMinYear,BSDate.cl_dpMinMonth,BSDate.cl_dpMinDay,0,0);
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(dateCompare(dt, dMax)<=0 && dateCompare(dt, dMin)>=0)...{
this.bsdate=dt;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else if (dateCompare(dt, dMax)>0)...{
this.bsdate = dMax
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else if (dateCompare(dt, dMin)<0)...{
this.bsdate = dMin
}
hr=true;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if(hr)...{
this.setInputDate();
}
return hr;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//选择今天
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.toDay = function(event)...{
event.returnValue=false;
var today = new Date();
this.bsdate.setYear(today.getFullYear());
this.bsdate.setMonth(today.getMonth());
this.bsdate.setDate(today.getDate());
this.bsdate.setHours(today.getHours());
this.bsdate.setMinutes(today.getMinutes());
this.setDateHTML();
BSPopup.document.body.innerHTML=BSDate.dateHTML;
return false;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//选择天
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.changeDay = function(event, inYear, inMonth, inDay)...{
//event.returnValue=false;
this.bsdate.setYear(inYear);
this.bsdate.setMonth(inMonth);
this.bsdate.setDate(inDay);
this.setDateHTML();
BSPopup.document.body.innerHTML=BSDate.dateHTML;
return false;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//改变小时
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.changeHour = function(event, inHour)...{
event.returnValue=false;
this.bsdate.setHours(this.bsdate.getHours() + inHour);
this.setDateHTML();
BSPopup.document.body.innerHTML=BSDate.dateHTML;
return false;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//改变分钟
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.changeMin = function(event, inMin)...{
event.returnValue=false;
this.bsdate.setMinutes(this.bsdate.getMinutes() + inMin);
this.setDateHTML();
BSPopup.document.body.innerHTML=BSDate.dateHTML;
return false;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//翻月
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
this.changeMonth = function(event, arrFlg)...{
var dMax=new Date(BSDate.cl_dpMaxYear,BSDate.cl_dpMaxMonth-1,BSDate.cl_dpMaxDay,0,0);
var dMin=new Date(BSDate.cl_dpMinYear,BSDate.cl_dpMinMonth+1,BSDate.cl_dpMinDay,0,0);
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (arrFlg)...{
//上一月
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (dateCompare(this.bsdate, dMin)>0)...{
this.bsdate.setMonth(this.bsdate.getMonth()-1);
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (dateCompare(this.bsdate, dMax)<0)...{
this.bsdate.setMonth(this.bsdate.getMonth()+1);
}
}
this.setDateHTML();
BSPopup.document.body.innerHTML=BSDate.dateHTML;
}
}