日期:2014-05-16 浏览次数:20533 次
?
/**
* 解析字符数组;
* @param strArray
*/
CheckOut.ParseArray = function (strArray){
var arrayParam = null;
var validateTypeName = null;
if(strArray!=null && strArray!="" && strArray!= undefined){
//判断是否有"[]",分隔符等.
if(strArray.indexOf("[")!=-1 && strArray.indexOf("]")!=-1){
arrayParam = strArray.substring(strArray.indexOf("["),(strArray.indexOf("]")+1));
}
if(strArray.indexOf("[")!=-1){
//获取[]前面的验证类型名称;
validateTypeName = strArray.substring(0,strArray.indexOf("["));
}else{
validateTypeName = strArray.substring(0,strArray.length);
}
}
//获取验证类型的参数列表;
this.getArrayParam = function(){
if(arrayParam!=null){
return eval("("+arrayParam+")");
}else{
return null;
}
};
//获取验证类型名称;
this.getValidateTypeName = function(){
return validateTypeName;
};
};
/**
* 设置提示信息;
* @param txtLeft
* @param txtRight
* @param bol
* @returns {getImagePosition}
*/
CheckOut.setImagePosition = function(txtObj,bol,tipMessage){
//获取文本框的位置;
var left = txtObj.offset().left;
var top = txtObj.offset().top;
//获取文本框的宽度;
var txtWidth = txtObj.innerWidth();
var txtHeight = txtObj.innerHeight();
//移除图标;
txtObj.parent().children("#successDivID").remove();
txtObj.parent().children("#errorDivID").remove();
//验证成功,否则验证失败;
if(bol){
txtObj.parent().append("<div id='successDivID' class='success_checkout'></div>");
txtObj.parent().children("#successDivID").css("left",left+txtWidth-15).css("top",top+4);
txtObj.parent().children("#tipMsgDivID").remove();
}else{
txtObj.parent().append("<div id='errorDivID' class='error_checkout'></div>");
txtObj.parent().append("<div id='tipMsgDivID' style='width:200px;position: absolute'><div id='pointerDivID' class='error_pointer'></div>"+
"<div id='errorMsgDivId' class='error_message' style='margin-left: 9px;padding-top: 2px;'>"+tipMessage+"</div></div>");
//设置错误图标和显示信息层;
txtObj.parent().children("#errorDivID").css("left",left+txtWidth-15).css("top",top+4);
txtObj.parent().children("#tipMsgDivID").css("left",left+50).css("top",top);
//鼠标移入事件;
txtObj.parent().children("#errorDivID").bind("mouseover",function(){
txtObj.parent().children("#tipMsgDivID").show();
//鼠标移出事件;
}).bind("mouseout",function(){
txtObj.parent().children("#tipMsgDivID").hide();
});
}
};
/**
* 验证类型Model;
*/
function ValidateEntity(key,functionName){
this.getKey =key;
this.getFunctionName = functionName;
}
?