/*
 * 判断表单项是否为空
 * name 是 表单项id
 * alertValue 是显示名称
 */
function check(name,alertValue){
	var check=document.getElementById(name);
	if(check.value.length==0||check.value.trim()==""||check.value.trim()==null){
		alert(alertValue);
		check.focus();
		return false;
	}else {
		return true;
	}

}

/*
 * 求2个表单项的值是否一致
 * id1 表单项1
 * id2 表单项2
 * alertValue 输出信息
 */
function compare(id1,id2,alertValue){
	var value1=document.getElementById(id1);
	var value2=document.getElementById(id2);
	if(value1.value!=value2.value){
		alert(alertValue);
		value1.focus();
		return false;
	}else{
		return true;
	}
}
/*
 * 限制表单项之间的大小范围
 * name 表单项
 * length1 最小长度
 * length2 最大长度
 * alertValue 输出信息
 */
function compare_length(name,length1,length2,alertValue){
	var value1=document.getElementById(name);
	if(value1.value.length>=length1&&value1.value.length<=length2){
		return true;
	}else{
		alert(alertValue);
		value1.focus();
		return false;
	}
}

/*
 * 判断表单项是否为数字
 * name 表单项
 * alertValue 输出信息
 */
function checkNum(name,alertValue){
	var numValue=document.getElementById(name);
	if(numValue.value.isValidNumber()){
		return true;
	}else {
		alert(alertValue);
		numValue.focus();
		return false;
		
	}
}

/*
 * 判断表单项是否为数字或英文字母
 * name 表单项
 * alertValue 输出信息
 */
function checkletter(name,alertValue){
	var letterValue=document.getElementById(name);
	if(letterValue.value.isValidAlphanumeric()){
		return true;
	}else{
		alert(alertValue);
		letterValue.focus();
		return false;
	}
	
}

function checklength(name,length,alertValue){
	var checkValue=document.getElementById(name);
	if(checkValue.value.length>length){
		alert(alertValue);
		checkValue.focus();
		return false;
	}else{
		return true;
	}
}


