-
-
- function check_blank(obj, obj_name){
- if(obj.value != ''){
- return true;
- }else{
- alert(obj_name + "所填不能为空!");
- obj.value = "";
- return false;
- }
- }
-
-
- function check_str_len(name,obj,maxLength){
- obj.value=obj.value.replace(/(^\s*)|(\s*$)/g, "");
- var newvalue = obj.value.replace(/[^\x00-\xff]/g, "**");
- var length11 = newvalue.length;
- if(length11>maxLength){
- alert(name+"的长度不能超过"+maxLength+"个字符!");
- obj.value="";
- obj.focus();
- }
- }
-
-
- function checkNumber(obj){
- var reg = /^[0-9]+$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- alert('只能输入数字!');
- obj.value = "";
- obj.focus();
- return false;
- }
- }
-
-
-
- function check_num_value(obj_name,obj,minvalue,maxvalue){
- var reg = /^[0-9]+$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- alert(obj_name+'只能输入数字!');
- obj.value = "";
- obj.focus();
- return false;
- }else if(minvalue>obj.value||obj.value>maxvalue){
- alert(obj_name+"的范围是"+minvalue+"-"+maxvalue+"!");
- obj.value="";
- obj.focus();
- return false;
- }
-
- }
-
-
- function checkZmOrNum(zmnum){
- var zmnumReg=/^[0-9a-zA-Z]*$/;
- if(zmnum.value!=""&&!zmnumReg.test(zmnum.value)){
- alert("只能输入是字母或者数字,请重新输入");
- zmnum.value="";
- zmnum.focus();
- return false;
- }
- }
-
-
- function check_double(obj,obj_name){
- var reg = /^[0-9]+(\.[0-9]+)?$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- alert(obj_name+'所填必须为有效的双精度数字');
- obj.value = "";
- obj.focus();
- return false;
- }
- }
-
-
-
- function checkboxs_all(obj,cName){
- var checkboxs = document.getElementsByName(cName);
- for(var i=0;i<checkboxs.length;i++){
- checkboxs[i].checked = obj.checked;
- }
- }
-
-
-
- function check_youbian(obj){
- var reg=/^\d{6}$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- alert('邮政编码格式输入错误!');
- obj.value = "";
- obj.focus();
- return false;
- }
- }
-
-
- function check_email(obj){
- var reg = /^[a-zA-Z0-9_-]+(\.([a-zA-Z0-9_-])+)*@[a-zA-Z0-9_-]+[.][a-zA-Z0-9_-]+([.][a-zA-Z0-9_-]+)*$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- obj.select();
- alert('电子邮箱格式输入错误!');
- obj.value = "";
- obj.focus();
- return false;
- }
- }
-
-
-
-
-
-
-
-
- function check_phone(obj){
- var reg=/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- alert('电话号码格式输入错误!');
- obj.value = "";
- obj.focus();
- return false;
- }
- }
-
-
- function check_telephone(obj){
- var reg= /^[1][358]\d{9}$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- alert('手机号码格式输入错误!');
- obj.value = "";
- obj.focus();
- return false;
- }
- }
-
-
- function isChinese(obj,obj_name){
- var reg=/^[\u0391-\uFFE5]+$/;
- if(obj.value!=""&&!reg.test(obj.value)){
- alert(obj_name+'必须输入中文!');
- obj.value = "";
- obj.focus();
- return false;
- }
- }
-
-
-
- function checkIsIE(){
- if(-[1,]){
- alert("这不是IE浏览器!");
- }else{
- alert("这是IE浏览器!");
- }
- }
-
-
- function check_IsUrl(obj){
-
-
- }
-
-
- function checkDate(obj,obj_name){
- var obj_value=obj.value.replace(/-/g,"/");
-
- var date1=new Date(Date.parse(obj_value));
- var date2=new Date();
- if(date1>date2){
- alert(obj_name+"不能大于当前时间!");
- return false;
- }
- }
-