//JS获取上下文路径 /* var rootpath; var webroot = document.location.href; webroot = webroot.substring(webroot.indexOf('//') + 2, webroot.length); webroot = webroot.substring(webroot.indexOf('/') + 1, webroot.length); webroot = webroot.substring(0, webroot.indexOf('/')); rootpath = "/" + webroot; if(rootpath=='/'){ rootpath=''; } */ var rootpath=''; //alert(rootpath); //解决jQuery与其它类库的冲突问题 $j=jQuery.noConflict(); /** * 是否正确的EMAIL格式 * str 字符串 * return 0:错误,1、正确或为空 */ function isRightEmail(str) { var reg=/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\.[A-Za-z0-9-]+)*((\.[A-Za-z0-9]{2,})|(\.[A-Za-z0-9]{2,}\.[A-Za-z0-9]{2,}))$/; var result=reg.test(str); return result; } /** * 判断手机号码 * telephone 手机号码 * return true 正确 */ function checkCellPhone(telephone) { var telephone = telephone; var reg0 = /^13\d{5,9}$/; var reg1 = /^15\d{5,9}$/; var reg2 = /^18\d{5,9}$/; var reg3 = /^0\d{10,11}$/; var my = false; if (reg0.test(telephone)) { my = true; } if (reg1.test(telephone)) { my = true; } if (reg2.test(telephone)) { my = true; } if (reg3.test(telephone)) { my = true; } return my; } /** * 判断电话号码、传真号码 * fax 电话号码、传真号码 * return true 正确 */ function checkFax(fax) { var p1 = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/; var me = false; if (p1.test(fax)) { me = true; } return me; }