form Verification
?input?
?required? oninvalid="setCustomValidity('user define');" oninput="setCustomValidity('');" ?placeholder="First and last name"
Text verification
<input type= "text" ?pattern="[0-9]{12}"/>
<input type="text" maxlength="30" minlength="10"/>
Number type verification?
設(shè)置max min step工坊,<input type="number" min="0" max="100" step="10" value="20"/>
email url verification?
<input type="email/url" value=""/>
File verification
form?should add attribute ?enctype="multipart/form-data"
<input? id="fileId1"type="file"? accept="image/png, image/gif"? multiple="multiple" name="file"/>
JS 正則驗(yàn)證
http://www.cnblogs.com/zfc2201/archive/2012/12/18/2824107.html
Email : /^\w+([-+.]\w+)*@\w+([-.]\\w+)*\.\w+([-.]\w+)*$/
isEmail1 : /^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w+$/;
isEmail2 : /^.*@[^_]*$/;
Phone : /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/
Mobile : /^((\(\d{3}\))|(\d{3}\-))?13\d{9}$/
Url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/
IdCard : /^\d{15}(\d{2}[A-Za-z0-9])?$/
Currency : /^\d+(\.\d+)?$/
Number : /^\d+$/
Code : /^[1-9]\d{5}$/
QQ : /^[1-9]\d{4,8}$/
Integer : /^[-\+]?\d+$/
Double : /^[-\+]?\d+(\.\d+)?$/
English : /^[A-Za-z]+$/
Chinese : /^[\u0391-\uFFE5]+$/
UnSafe : /^(([A-Z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0,5})$|\s/
PassWord :^[\\w]{6,12}$
ZipCode : ^[\\d]{6}
/^(\+\d+ )?(\(\d+\) )?[\d ]+$/; //這個(gè)是國(guó)際通用的電話號(hào)碼判斷
/^(1[0-2]\d|\d{1,2})$/; //這個(gè)是年齡的判斷
/^\d+\.\d{2}$/;? //這個(gè)是判斷輸入的是否為貨幣值
ip_ip = '(25[0-5]|2[0-4]\\d|1\\d\\d|\\d\\d|\\d)';
ip_ipdot = ip + '\\.';
isIPaddress = new RegExp('^'+ip_ipdot+ip_ipdot+ipdot+ip_ip+'$');