最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
jQueryValidate驗(yàn)證文件驗(yàn)證

jQuery Validate

創(chuàng)新互聯(lián)建站云計(jì)算的互聯(lián)網(wǎng)服務(wù)提供商,擁有超過13年的服務(wù)器租用、成都機(jī)柜租用、云服務(wù)器、網(wǎng)頁空間、網(wǎng)站系統(tǒng)開發(fā)經(jīng)驗(yàn),已先后獲得國家工業(yè)和信息化部頒發(fā)的互聯(lián)網(wǎng)數(shù)據(jù)中心業(yè)務(wù)許可證。專業(yè)提供云主機(jī)、網(wǎng)頁空間、空間域名、VPS主機(jī)、云服務(wù)器、香港云服務(wù)器、免備案服務(wù)器等。

jQuery Validate 插件為表單提供了強(qiáng)大的驗(yàn)證功能,讓客戶端表單驗(yàn)證變得更簡(jiǎn)單,同時(shí)提供了大量的定制選項(xiàng),滿足應(yīng)用程序各種需求。

1、導(dǎo)入 js 庫


2、默認(rèn)校驗(yàn)規(guī)則

序號(hào)規(guī)則描述
1required:true必須輸入的字段。
2remote:"check.php"使用 ajax 方法調(diào)用 check.php 驗(yàn)證輸入值。
3email:true必須輸入正確格式的電子郵件。
4url:true必須輸入正確格式的網(wǎng)址。
5date:true必須輸入正確格式的日期。日期校驗(yàn) ie6 出錯(cuò),慎用。
6dateISO:true必須輸入正確格式的日期(ISO),例如:2009-06-23,1998/01/22。只驗(yàn)證格式,不驗(yàn)證有效性。
7number:true必須輸入合法的數(shù)字(負(fù)數(shù),小數(shù))。
8digits:true必須輸入整數(shù)。
9creditcard:必須輸入合法的信用卡號(hào)。
10equalTo:"#field"輸入值必須和 #field 相同。
11accept:輸入擁有合法后綴名的字符串(上傳文件的后綴)。
12maxlength:5輸入長(zhǎng)度最多是 5 的字符串(漢字算一個(gè)字符)。
13minlength:10輸入長(zhǎng)度最小是 10 的字符串(漢字算一個(gè)字符)。
14rangelength:[5,10]輸入長(zhǎng)度必須介于 5 和 10 之間的字符串(漢字算一個(gè)字符)。
15range:[5,10]輸入值必須介于 5 和 10 之間。
16max:5輸入值不能大于 5。
17min:10輸入值不能小于 10。

例子:

$().ready(function() {// 在鍵盤按下并釋放及提交后驗(yàn)證提交表單
  $("#signupForm").validate({
    rules: {
      firstname: "required",
      lastname: "required",
      username: {
        required: true,
        minlength: 2
      },
      password: {
        required: true,
        minlength: 5
      },
      confirm_password: {
        required: true,
        minlength: 5,
        equalTo: "#password"
      },
      email: {
        required: true,
        email: true
      },
      topic: {
        required: "#newsletter:checked",
        minlength: 2
      },
      agree: "required"
    },
    messages: {
      firstname: "請(qǐng)輸入您的名字",
      lastname: "請(qǐng)輸入您的姓氏",
      username: {
        required: "請(qǐng)輸入用戶名",
        minlength: "用戶名必需由兩個(gè)字母組成"
      },
      password: {
        required: "請(qǐng)輸入密碼",
        minlength: "密碼長(zhǎng)度不能小于 5 個(gè)字母"
      },
      confirm_password: {
        required: "請(qǐng)輸入密碼",
        minlength: "密碼長(zhǎng)度不能小于 5 個(gè)字母",
        equalTo: "兩次密碼輸入不一致"
      },
      email: "請(qǐng)輸入一個(gè)正確的郵箱",
      agree: "請(qǐng)接受我們的聲明",
      topic: "請(qǐng)選擇兩個(gè)主題"
     }
    })});

3.特別注意

對(duì)于accept的用法 accept:“MIME types”

具體的可能用到的MINIEType如下:

.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template 

.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document

.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation

.doc,application/msword

.dot,application/msword

.xls,application/vnd.ms-excel

.ppt - application/mspowerpoint 


.ai - application/postscript 

.aif - audio/x-aiff 

.aifc - audio/x-aiff 

.aiff - audio/x-aiff 

.asc - text/plain 

.au - audio/basic 

.avi - video/x-msvideo 

.bcpio - application/x-bcpio 

.bin - application/octet-stream 

.c - text/plain 

.cc - text/plain 

.ccad - application/clariscad 

.cdf - application/x-netcdf 

.class - application/octet-stream 

.cpio - application/x-cpio 

.cpt - application/mac-compactpro 

.csh - application/x-csh 

.css - text/css 

.dcr - application/x-director 

.dir - application/x-director 

.dms - application/octet-stream 

.doc - application/msword 

.drw - application/drafting 

.dvi - application/x-dvi 

.dwg - application/acad 

.dxf - application/dxf 

.dxr - application/x-director 

.eps - application/postscript 

.etx - text/x-setext 

.exe - application/octet-stream 

.ez - application/andrew-inset 

.f - text/plain 

.f90 - text/plain 

.fli - video/x-fli 

.gif - image/gif 

.gtar - application/x-gtar 

.gz - application/x-gzip 

.h - text/plain 

.hdf - application/x-hdf 

.hh - text/plain 

.hqx - application/mac-binhex40 

.htm - text/html 

.html - text/html 

.ice - x-conference/x-cooltalk 

.ief - image/ief 

.iges - model/iges 

.igs - model/iges 

.ips - application/x-ipscript 

.ipx - application/x-ipix 

.jpe - image/jpeg 

.jpeg - image/jpeg 

.jpg - image/jpeg 

.js - application/x-javascript 

.kar - audio/midi 

.latex - application/x-latex 

.lha - application/octet-stream 

.lsp - application/x-lisp 

.lzh - application/octet-stream 

.m - text/plain 

.man - application/x-troff-man 

.me - application/x-troff-me 

.mesh - model/mesh 

.mid - audio/midi 

.midi - audio/midi 

.mif - application/vnd.mif 

.mime - www/mime 

.mov - video/quicktime 

.movie - video/x-sgi-movie 

.mp2 - audio/mpeg 

.mp3 - audio/mpeg 

.mpe - video/mpeg 

.mpeg - video/mpeg 

.mpg - video/mpeg 

.mpga - audio/mpeg 

.ms - application/x-troff-ms 

.msh - model/mesh 

.nc - application/x-netcdf 

.oda - application/oda 

.pbm - image/x-portable-bitmap 

.pdb - chemical/x-pdb 

.pdf - application/pdf 

.pgm - image/x-portable-graymap 

.pgn - application/x-chess-pgn 

.png - image/png 

.pnm - image/x-portable-anymap 

.pot - application/mspowerpoint 

.ppm - image/x-portable-pixmap 

.pps - application/mspowerpoint 

.ppt - application/mspowerpoint 

.ppz - application/mspowerpoint 

.pre - application/x-freelance 

.prt - application/pro_eng


網(wǎng)站標(biāo)題:jQueryValidate驗(yàn)證文件驗(yàn)證
文章位置:http://fisionsoft.com.cn/article/pgocsd.html