function isusername (s) { var regu = "^([a-za-z]+[_0-9a-za-z@.-]*)$" var re = new regexp(regu); if (s.search(re) != -1) { return true; } else { window.alert ("请使用规范的会员名!") return false; } } function ismobile(s) { //pattern: 手机号为数字,长度大于等于8且小于等于11 var patrn = /^(\d{7,11})?$/; if (!patrn.exec(s)) return false return true } function isemail (s) { // writen by david, we can delete the before code if (s.length > 50) { window.alert("email地址长度不能超过50位!"); return false; } s = s.tolowercase() // var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*[0-9a-za-z]+))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int)$" //var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int|name|name)$" //modified by ryan gao 2005-12-16 //var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*[_.0-9a-za-z]+))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int|name|name)$"; //modified by ryan gao 2005-12-28 电子邮件地址结尾有_(如126) var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int|name|name)$"; var re = new regexp(regu); if (s.search(re) != -1) { return true; } else { window.alert ("请输入有效合法的e-mail地址 !"); return false; } } function isemail_e (s) { // writen by david, we can delete the before code if (s.length > 100) { window.alert("the email adress should be less than 100 characters!"); return false; } // var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*[0-9a-za-z]+))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int)$" //var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int|name|name)$" //modified by ryan gao 2005-12-16 //var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*[0-9a-za-z]+))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int|name|name)$"; //modified by ryan gao 2005-12-28 电子邮件地址结尾有_(如126) var regu = "^(([0-9a-za-z]+)|([0-9a-za-z]+[_.0-9a-za-z-]*))@([a-za-z0-9-]+[.])+([a-za-z]{2}|net|net|com|com|gov|gov|mil|mil|org|org|edu|edu|int|int|name|name)$"; var re = new regexp(regu); if (s.search(re) != -1) { return true; } else { window.alert ("please enter a valid email address!") return false; } } function showclick(msg){ if(confirm(msg)){ event.returnvalue=true; }else{ event.returnvalue=false; } } function showsub(ss) { ss=document.getelementbyid(ss) if (ss.style.display=="none") {ss.style.display=""; } else {ss.style.display="none"; } } 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; } }