css
#divform{width:80%; margin: 0 auto;}
#divform .divformrow{line-height: 34px; padding-top: 9px;}
#divform .divformrow .btnsb{margin: 0 auto; display:block;width: 120px;
background: #77C019;color: #FFFFFF;line-height: 32px;font-size: 14px;
border: none;border-radius: 4px;text-align: center;font-weight: bold;}
#divform .divformrow .label {
float: left;width: 15%;overflow: hidden;font-size: 18px;color: #505050;height: 40px;line-height: 40px;
}
#divform .divformrow .label em{margin-right: 5px; color: #e60011;text-align: right;}
#divform .divformrow .divformcol{width: 75%;position:relative;}
#divform .divformrow .divformcol select{color: #999999;
font-family: arial;font-size: 14px;padding: 5px 5px 5px 18px;}
#divform .divformrow .divformcol input{float: left;
width:65%;height: 40px;line-height: 40px;border: 1px solid rgba(28,87,134,0.1);padding: 0 10px;
font-size: 16px;color: #333;
}
#divform .divformrow .divformcol input.btnchkcode{width:90px;padding-left: 2px;
background: #77C019;color: #FFFFFF;line-height: 24px;font-size: 14px;position:absolute;
border: none;border-radius: 4px;text-align: center;font-weight: bold;right:0;top:0;
}
#divform .divformrow .divformcol button.btnchkcode{width:90px;padding-left: 2px;
background: #77C019;color: #FFFFFF;line-height:40px;font-size: 14px;position:absolute;
border: none;border-radius: 4px;text-align: center;font-weight: bold;right:0;top:0;
}
#divform .divformrow .divformcol input.validerror{background-color: #fff;border: 1px solid red;}
#divform .divformrow .divformcol .info{display: none; color: rgb(102, 102, 102);}
#divform .divformrow .divformcol .validform_wrong{color: red;padding-left: 20px;white-space: nowrap;display:none;
background: url(https://qd.andiff.net/script/form/image/check_error.gif) no-repeat;height: 38px;line-height: 38px;margin-left: 10px;
}
#divform .divformrow .divformcol .validform_right{
background: url(https://qd.andiff.net/script/form/image/check_right.gif) no-repeat;display:none;
height: 38px;line-height: 38px;margin-left: 10px;padding-left: 20px;
}
#divform .form_title {margin-top: 10px;padding: 0 0 10px 10px;
border-bottom: #CCCCCC 1px solid;font-weight: bold;font-size: 16px;color: #FF6600;
}
#divform .divformrow .plupload-preview {
padding: 10px 10px; margin-bottom: 0;display:block;width:98%;text-align:center;
}
#divform .divformrow .list-inline > li {
display: inline-block;padding-left: 5px;padding-right: 5px;
}
.img-responsive, .thumbnail > img, .thumbnail a > img, .carousel-inner > .item > img, .carousel-inner > .item > a > img {
display: block; max-width:100px; height:100px;
}
js
var regexEnum =
{
intege:"^-?[1-9]\\d*$", //整数
intege1:"^[1-9]\\d*$", //正整数
intege2:"^-[1-9]\\d*$", //负整数
num:"^([+-]?)\\d*\\.?\\d+$", //数字
num1:"^[1-9]\\d*|0$", //正数(正整数 + 0)
num2:"^-[1-9]\\d*|0$", //负数(负整数 + 0)
decmal:"^([+-]?)\\d*\\.\\d+$", //浮点数
decmal1:"^[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*$", //正浮点数
decmal2:"^-([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*)$", //负浮点数
decmal3:"^-?([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*|0?.0+|0)$", //浮点数
decmal4:"^[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*|0?.0+|0$", //非负浮点数(正浮点数 + 0)
decmal5:"^(-([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*))|0?.0+|0$", //非正浮点数(负浮点数 + 0)
email:"^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", //邮件
color:"^[a-fA-F0-9]{6}$", //颜色
url:"^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-./?%&=]*)?$", //url
chinese:"^[\\u4E00-\\u9FA5\\uF900-\\uFA2D]+$", //仅中文
ascii:"^[\\x00-\\xFF]+$", //仅ACSII字符
zipcode:"^\\d{6}$", //邮编
mobile:"^(13|15|18|17)[0-9]{9}$", //手机
ip4:"^(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)$", //ip地址
notempty:"^\\S+$", //非空
picture:"(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$", //图片
rar:"(.*)\\.(rar|zip|7zip|tgz)$", //压缩文件
date:"^\\d{4}(\\-|\\/|\.)\\d{1,2}\\1\\d{1,2}$", //日期
qq:"^[1-9]*[1-9][0-9]*$", //QQ号码
tel:"^(([0\\+]\\d{2,3}-)?(0\\d{2,3})-)?(\\d{7,8})(-(\\d{3,}))?$", //电话号码的函数(包括验证国内区号,国际区号,分机号)
username:"^\\w+$", //用来用户注册。匹配由数字、26个英文字母或者下划线组成的字符串
letter:"^[A-Za-z]+$", //字母
letter_u:"^[A-Z]+$", //大写字母
letter_l:"^[a-z]+$", //小写字母
idcard:"^[1-9]([0-9]{14}|[0-9]{17})$" //身份证
}
var aCity={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"}
function isCardID(str){
var a = str.match(regexEnum.idcard);
if (a == null) {return false;}
return true;
}
function isempty(str){
var a = str.match(regexEnum.notempty);
if (a == null) {return false;}
return true;
}
function isurl(str){
var a = str.match(regexEnum.url);
if (a == null) {return false;}
return true;
}
function ischinese(str){
var a = str.match(regexEnum.chinese);
if (a == null) {return false;}
return true;
}
function isqq(str){
var a = str.match(regexEnum.qq);
if (a == null) {return false;}
return true;
}
function isint(str){
var a = str.match(regexEnum.intege1);
if (a == null) {return false;}
return true;
}
function isdecmal1(str){
var a = str.match(regexEnum.decmal1);
if (a == null) {return false;}
return true;
}
function isemail(str){
var a = str.match(regexEnum.email);
if (a == null) {return false;}
return true;
}
//验证手机是否正确
function ismobile(str){
var a = str.match(regexEnum.mobile);
if (a == null) {return false;}
return true;
}
//电话
function istel(str)
{
var a = str.match(regexEnum.tel);
if (a == null) {return false;}
return true;
}
//短时间,形如 (13:04:06)
function isTime(str)
{
var a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
if (a == null) {return false}
if (a[1]>24 || a[3]>60 || a[4]>60)
{
return false;
}
return true;
}
//短日期,形如 (2003-12-05)
function isDate(str)
{
var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
if(r==null)return false;
var d= new Date(r[1], r[3]-1, r[4]);
return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);
}
//长时间,形如 (2003-12-05 13:04:06)
function isDateTime(str)
{
var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
var r = str.match(reg);
if(r==null) return false;
var d= new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]);
return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]);
}
function checkainput(obj,ss){
if(typeof(obj.val())!='undefined'){
var b = false;
switch(ss){
case 'mobile':
b = ismobile(obj.val());
break;
case 'empty':
b = isempty(obj.val());
break;
case 'email':
b = isemail(obj.val());
break;
case 'tel':
b = istel(obj.val());
break;
case 'int':
b = isint(obj.val());
break;
case 'qq':
b = isqq(obj.val());
break;
case 'url':
b = isurl(obj.val());
break;
case 'date':
b = isDate(obj.val());
break;
case 'datetime':
b = isDateTime(obj.val());
break;
case 'decimal':
b = isdecmal1(obj.val());
break;
case 'time':
b = isTime(obj.val());
break;
}
if(!b){
obj.next().next().show();return true;
}else{
obj.next().next().hide();return false;
}
}
}