/*------------------------------------------------------------
dateDlg(inputid,initDate,startYear,endYear) 弹出时间窗口
compareDate(end,s) 与当前时间比较
compareTwoDate(startDate,endDate,s) 比较两个时间
isNumber(text,name) 判断全是数字(true)
isChar(text,addtemp,name,include) 判断符合要求字符
isEmail(text) 判断是电子邮件
isPid(text) 判断是身份证号
isNull(text,name) 判断为空则提示(true)
getLength(text) 获取长度
lengthEquals(text,name,num) 确定长度(true)
lengthless(text,name,num) 长度不少于(true)
lengthmore(text,name,num) 长度不大于(true)
checkPassword(text,text1) 检验两次输入密码是否一致(true)
------------------------------------------------------------
//checkData()放在jsp页面
------------------------------------------------------------*/
/*------------------------------------------------------------
弹出时间选择小控件
inputid--文本框name
initDate--初始日期,为空时是当前时间
startYear--日期范围的开始日期
endYear--日期范围的结束日期
使用例子onClick="dateDlg(end,'1999-11-12','1980','2010')"
------------------------------------------------------------*/
function dateDlg(inputid,initDate,startYear,endYear)
{
var pattern = /^(19|20)([0-9]){2}$/;
flag=pattern.test(startYear);
if(!flag)startYear=1900;
flag=pattern.test(endYear);
if(!flag)endYear=2050;
if(inputid.value==null||inputid.value=='')
{
if(initDate==null||initDate=='')
{
currentDate = new Date();
}
else{
currentDate = initDate;
}
}
else{
currentDate = inputid.value;
}
var arguments = new Array(startYear,endYear,0,0,0)
var pattern = /^(19|20)([0-9]){2}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/;
flag=pattern.test(currentDate);
if(flag)
{
iYear=currentDate.substring(0,4);
iMonth=currentDate.substring(5,7);
iDay=currentDate.substring(8,10);
arguments = new Array(startYear,endYear,iYear,iMonth,iDay)
}
showx = event.screenX - event.offsetX + 18;
showy = event.screenY - event.offsetY - 210;
var features =
'dialogWidth:' + 192 + 'px;' +
'dialogHeight:' + 210 + 'px;' +
'dialogLeft:' + showx + 'px;' +
'dialogTop:' + showy + 'px;' +
'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
retval = window.showModalDialog("../js/calendar.htm", arguments , features );
var calctrl = eval(inputid)
if( retval != null ){
calctrl.value = retval;
}else{
//alert("canceled");
}
}
/*------------------------------------------------------------
Trim()去左右空格
------------------------------------------------------------*/
String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.Rtrim = function()
{
return this.replace(/(\s*$)/g, "");
}
/*------------------------------------------------------------
判断密码是否有单引号
------------------------------------------------------------*/
function isNotYinhao(s)
{
var yin;
var temp="'";
for(yin=0; yin < s.length; yin++ )
{
var ch = s.charAt(yin);
if(temp.indexOf(ch)>=0)
{
return true;
}
}
return false;
}