function
obj$(id){
return
document.getElementById(id);
};
function
val$(id){
var
obj= document.getElementById(id);
if(obj!==null){
return
obj.value();
}else{
return
null;
}
};
function
trimAll(str){
return
str.replace(/(^\s*)|(\s*$)/g,
''
);
};
function
trimLeft(str){
return
str.replace(/^\s*/g,
''
);
};
function
trimRight(str){
return
str.replace(/\s*$/,
''
);
}
function
isEmpty(str){
if(str
!= null && str.length >
0
)
{
return
true;
}
return
false;
}
function
isEquals(str
1
,str
2
){
if(str
1
==str
2
){
return
true;
}
return
false;
}
function
isEqualsIgnorecase(str
1
,str
2
){
if(str
1
.toUpperCase()
== str
2
.toUpperCase())
{
return
true;
}
return
false;
}
function
checkLength(obj,min,max){
if(obj.length
< min || obj.length > max) {
return
false;
}
else {
return
true;
}
}
function
isNum(value){
if(
value != null && value.length>
0
&& isNaN(value) == false){
return
true;
}
else{
return
false;
}
}
function
isChine(str){
var
reg = /^([\u
4
E
00
-\u
9
FA
5
]|[\uFE
30
-\uFFA
0
])*$/;
if(reg.test(str)){
return
false;
}
return
true;
}
function
getYear(){
var
year = null;
var
dateTime = this.getDateTime();
if(dateTime
!= null){
year
= dateTime.getFullYear();
}else{
year
= this.curDateTime.getFullYear();
}
return
year;
}
function
getMonth(){
var
month = null;
var
dateTime = this.getDateTime();
if(dateTime
!= null){
month
= dateTime.getMonth() +
1
;
}else{
month
= this.curDateTime.getMonth() +
1
;
}
return
month;
}
function
getDay(){
var
day = null;
var
dateTime = this.getDateTime();
if(dateTime
!= null){
day
= dateTime.getDate();
}else{
day
= this.curDateTime.getDate();
}
return
day;
}
function
getHour(){
var
hour = null;
var
dateTime = this.getDateTime();
if(dateTime
!= null){
hour
= dateTime.getHours();
}else{
hour
= this.curDateTime.getHours();
}
return
hour;
}
function
getMinute(){
var
minute = null;
var
dateTime = this.getDateTime();
if(dateTime
!= null){
minute
= dateTime.getMinutes();
}else{
minute
= this.curDateTime.getMinutes();
}
return
minute;
}
function
getSecond(){
var
second = null;
var
dateTime = this.getDateTime();
if(dateTime
!= null){
second
= dateTime.getSeconds();
}else{
second
= this.curDateTime.getSeconds();
}
return
second;
}
function
isLeapYear(){
var
flag = false;
if((this.getYear()
%
4
==
0
&& this.getYear() %
100
!=
0
)
||
(this.getYear() %
400
==
0
)){
flag
= true;
}
return
flag;
}