//网站顶部搜索表单验证. function checktopsearch() { if (jtrim(document.topsearchform.keyword.value)==''||jtrim(document.topsearchform.keyword.value)=='请输入关键字') { window.alert ("请输入关键字!"); document.topsearchform.keyword.value=""; document.topsearchform.keyword.focus(); return false; } return true } //网站首页项目搜索表单验证. function check_index_project_search() { if (jtrim(document.indexprojectsearchform.keyword.value)==''||jtrim(document.indexprojectsearchform.keyword.value)=='输入项目编号') { window.alert ("输入项目编号!"); document.indexprojectsearchform.keyword.value=""; document.indexprojectsearchform.keyword.focus(); return false; } return true } //网站内页项目搜索表单验证. function check_project_search() { if (jtrim(document.projectsearchform.keyword.value)==''||jtrim(document.projectsearchform.keyword.value)=='输入项目编号') { window.alert ("输入项目编号!"); document.projectsearchform.keyword.value=""; document.projectsearchform.keyword.focus(); return false; } return true } //////////jquery网页顶部消息提示框插件 配置begin////////////////////////// //为 tips 提示框自定义 css,以下为默认 xcsoft.tipscss = { height: '44px', fontsize: '16px' }; //隐藏、显示速度 ,默认 fast xcsoft.tipshide=xcsoft.tipsshow=100; //调用举例说明 //xcsoft.info('请填写你的相关信息哟',3000);//提示消息[3秒后自动消失] //xcsoft.success('你的信息更新完毕',1500);//成功消息[1.5秒后自动消失] //xcsoft.error('你还有信息未填写',2000);//失败消息[2秒后自动消失] //xcsoft.loading('正在更新中,请等待...');//加载消息[不会自动消失] //xcsoft._hide();//强制隐藏消息 //////////jquery网页顶部消息提示框插件 配置end////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////以下为基本公共函数///////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //重置表单函数 function formreset(formid){ document.getelementbyid(formid).reset() } //判断姓名是否为中文 function ischinesename(name) { var patrn = /^\s*[\u4e00-\u9fa5]{1,}[\u4e00-\u9fa5.·]{0,5}[\u4e00-\u9fa5]{1,}\s*$/; if(!patrn.exec(name)) { return false; } return true; } function is_mobile(s) { if(s.length!=11){return false;} if(isnan(s)){return false;} var sub_s = s.substr(0,3); var arr = new array(130,131,132,133,134,135,136,137,138,139,145,146,147,149,150,151,152,153,154,155,156,157,158,159,166,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199); for(var i = 0; i < arr.length; i++){ if(sub_s == arr[i]){ return true; } } return false; } //检查email地址是否有效. function is_email(s) { if(s.length<6 || s.length>50){ return false; }else{ var mytestexp = /^([a-za-z]|[0-9])(\w|\-)+@[a-za-z0-9]+\.([a-za-z]{2,4})$/; if(!mytestexp.test(s)){ return false; }else{ return true; } } } function is_username(s) { if(s.length<5 || s.length>20){ return false; }else{ //var regu = "^([a-za-z]+[_0-9a-za-z@.-]*)$" //字母(a-z)、数字(0-9)、@、点、中划线、下划线组成,且必须以字母开头 var regu = "^([a-za-z]+[_0-9a-za-z-]*)$" //字母(a-z)、数字(0-9)、中划线、下划线组成,且必须以字母开头 var re = new regexp(regu); if (s.search(re) != -1) { return true; } else { //window.alert ("会员登录名由字母(a-z)、数字(0-9)、中划线、下划线组成,且必须以字母开头!") return false; } } } function is_pwd(s) { if(s.length<5 || s.length>20){ return false; }else{ var mytestexp = /^[0-9a-za-z_-]{5,20}$/; if(!mytestexp.test(s)){ return false; }else{ return true; } } } function is_safedir(s) { if(s.length<5 || s.length>20){ return false; }else{ var regu = "^([a-za-z]+[_0-9a-za-z-]*)$" //字母(a-z)、数字(0-9)、中划线、下划线组成,且必须以字母开头 var re = new regexp(regu); if (s.search(re) != -1) { return true; } else { return false; } } } //判断字符是否为空的方法 function is_empty(obj){ if(typeof obj == "undefined" || obj == null || obj == "undefined" || obj == "nan" || obj == "" || obj == " " || obj.length == 0){ return true; }else{ return false; } } function is_mobiletwo(s) { //pattern: 手机号为数字,长度大于等于8且小于等于11 var patrn = /^(\d{7,11})?$/; if (!patrn.exec(s)) return false return true } function showclick(msg){ if(confirm(msg)){ event.returnvalue=true; }else{ event.returnvalue=false; } } function jtrim(str) { var i = 0; var len = str.length; if ( str == "" ) return( str ); j = len -1; flagbegin = true; flagend = true; while (( flagbegin == true) && (i< len)) { if ( str.charat(i) == " " ) { i=i+1; flagbegin=true; } else { flagbegin=false; } } while ((flagend== true) && (j>=0)) { if (str.charat(j)==" ") { j=j-1; flagend=true; } else { flagend=false; } } if ( i > j ) return (""); trimstr = str.substring(i,j+1); return trimstr; } function isvaliddate( year, month, day ) { year = parseint(year,10); month = parseint(month,10); day = parseint(day,10); if (( month==4) || (month==6) || (month==9) || (month==11) ) { if (( day < 1) || (day > 30) ) { alert( "日期在1 - 30之间" ); return (false); } } else { if ( month!=2 ) { if ( (day < 1) || (day > 31 )) { alert( "日期在1 - 31之间" ); return (false); } } else { // month == 2 if ( ( year % 100 ) != 0 && (year % 4 == 0) || ( year % 100 ) == 0 && ( year % 400) == 0 ) { if ( day > 29 ) { alert( "日期在1 - 29之间" ); return (false); } } else { if ( day > 28 ) { alert( "日期在1 - 28之间" ); return (false); } } } } return (true); } function isvaliddate_e( year, month, day ) { year = parseint(year,10); month = parseint(month,10); day = parseint(day,10); if (( month==4) || (month==6) || (month==9) || (month==11) ) { if (( day < 1) || (day > 30) ) { alert( "day must between 1 - 30" ); return (false); } } else { if ( month!=2 ) { if ( (day < 1) || (day > 31 )) { alert( "day must between 1 - 31" ); return (false); } } else { // month == 2 if ( ( year % 100 ) != 0 && (year % 4 == 0) || ( year % 100 ) == 0 && ( year % 400) == 0 ) { if ( day > 29 ) { alert( "day must between 1 - 29" ); return (false); } } else { if ( day > 28 ) { alert( "day must between 1 - 28" ); return (false); } } } } return (true); } function datecompare(yearfrom, monthfrom, yearto, monthto) { yearfrom = parseint(yearfrom,10); monthfrom = parseint(monthfrom,10); yearto = parseint(yearto,10); monthto = parseint(monthto,10); if (yearfrom > yearto) { return false;} else { if (yearfrom == yearto) { if (monthfrom > monthto) return false; } } return true; } function checkall(form) { for (var i=0;i0 && image.height>0){ flag=true; if(image.width/image.height>= iwidth/iheight){ if(image.width>iwidth){ imgd.width=iwidth; imgd.height=(image.height*iwidth)/image.width; }else{ imgd.width=image.width; imgd.height=image.height; } }else{ if(image.height>iheight){ imgd.height=iheight; imgd.width=(image.width*iheight)/image.height; }else{ imgd.width=image.width; imgd.height=image.height; } } } } function bbimg(o){ var zoom=parseint(o.style.zoom, 10)||100;zoom+=event.wheeldelta/12;if (zoom>0) o.style.zoom=zoom+'%'; return false; } function imgzoom(img,maxsize){ var a=new image(); a.src=img.src if(a.width > maxsize * 4) { img.style.width=maxsize; } else if(a.width >= maxsize) { img.style.width=math.round(a.width * math.floor(4 * maxsize / a.width) / 4); } return false; } function imgzoom01(img,maxsize){ var a=new image(); a.src=img.src if(a.width >= maxsize) { img.style.width=maxsize; } return false; } //图片自动调整的模式,1为按比例调整 ,2 按大小调整。 var resizemode=1 function imgresize(o){ if (resizemode==2 || o.onmousewheel){ if(o.width > 500 ){ o.style.width='500px'; } if(o.height > 800){ o.style.height='800px'; } }else{ var parentnode=o.parentnode.parentnode if (parentnode){ if (o.offsetwidth>=parentnode.offsetwidth) o.style.width='98%'; }else{ var parentnode=o.parentnode if (parentnode){ if (o.offsetwidth>=parentnode.offsetwidth) o.style.width='98%'; } } } } /////////////////////////////////////////////////////////////////////////图片大小控制函数 end function charcheck(regexpstr) { var inputchar = string.fromcharcode(event.keycode); if(regexpstr.test(inputchar)) { return true; } else { return false; } } function is_idcard(v_card)  //v_card为所传的身份证号  {      var reg = /^\d{15}(\d{2}[0-9x])?$/i;      if (!reg.test(v_card)){          return false;      }      if(v_card.length==15){          var n = new date();          var y = n.getfullyear();          if(parseint("19" + v_card.substr(6,2)) < 1900 || parseint("19" + v_card.substr(6,2)) > y){              return false;          }          var birth = "19" + v_card.substr(6,2) + "-" + v_card.substr(8,2) + "-" + v_card.substr(10,2);          if(!isbirthdate(birth)){              return false;          }      }      if(v_card.length==18){          var n = new date();          var y = n.getfullyear();          if(parseint(v_card.substr(6,4)) < 1900 || parseint(v_card.substr(6,4)) > y){              return false;          }          var birth = v_card.substr(6,4) + "-" + v_card.substr(10,2) + "-" + v_card.substr(12,2);          if(!isbirthdate(birth)){              return false;          }          iw = new array(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1);          isum = 0;          for( i=0;i<17;i++){              ic = v_card.charat(i);              ival = parseint(ic);              isum += ival * iw[i];          }          ijym = isum % 11;          if(ijym == 0) sjym = "1";          else if(ijym == 1) sjym = "0";          else if(ijym == 2) sjym = "x";          else if(ijym == 3) sjym = "9";          else if(ijym == 4) sjym = "8";          else if(ijym == 5) sjym = "7";          else if(ijym == 6) sjym = "6";          else if(ijym == 7) sjym = "5";          else if(ijym == 8 ) sjym = "4";          else if(ijym == 9) sjym = "3";          else if(ijym == 10) sjym = "2";          var ccheck = v_card.charat(17).tolowercase();          if( ccheck != sjym ){              return false;          }      }      try{          var lvareaid=v_card.substr(0,2);          return lvareaid == "11" || lvareaid == "12" || lvareaid == "13" || lvareaid == "14" || lvareaid == "15" || lvareaid == "21" || lvareaid == "22" || lvareaid == "23" || lvareaid == "31" || lvareaid == "32" || lvareaid == "33" || lvareaid == "34" || lvareaid == "35" || lvareaid == "36" || lvareaid == "37" || lvareaid == "41" || lvareaid == "42" || lvareaid == "43" || lvareaid == "44" || lvareaid == "45" || lvareaid == "46" || lvareaid == "50" || lvareaid == "51" || lvareaid == "52" || lvareaid == "53" || lvareaid == "54" || lvareaid == "61" || lvareaid == "62" || lvareaid == "63" || lvareaid == "64" || lvareaid == "65" || lvareaid == "71" || lvareaid == "82" || lvareaid == "82";      //if(searchidcodematch(v_card.substr(0,6))==-1)      //{      //   return false;      //}      }      catch(ex){      }      return true;  }  //出生年月判断  function isbirthdate(strdate) {      var strseparator = "-"; //日期分隔符      var strdatearray;      var intyear;      var intmonth;      var intday;      var boolleapyear;      strdatearray = strdate.split(strseparator);      if (strdatearray.length != 3)          return false;      intyear = parseint(strdatearray[0], 10);      intmonth = parseint(strdatearray[1], 10);      intday = parseint(strdatearray[2], 10);      if (isnan(intyear) || isnan(intmonth) || isnan(intday))          return false;      if (intmonth > 12 || intmonth < 1)          return false;      if ((intmonth == 1 || intmonth == 3 || intmonth == 5 || intmonth == 7 || intmonth == 8 || intmonth == 10 || intmonth == 12) && (intday > 31 || intday < 1))          return false;      if ((intmonth == 4 || intmonth == 6 || intmonth == 9 || intmonth == 11) && (intday > 30 || intday < 1))          return false;      if (intmonth == 2) {          if (intday < 1)              return false;          boolleapyear = false;          if ((intyear % 100) == 0) {              if ((intyear % 400) == 0)                  boolleapyear = true;          } else {              if ((intyear % 4) == 0)                  boolleapyear = true;          }          if (boolleapyear) {              if (intday > 29)                  return false;          } else {              if (intday > 28)                  return false;          }      }      return true;  }