日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

ASP.NET jQuery 食譜17 (通過(guò)使用jQuery valida

系統(tǒng) 2375 0

這節(jié)介紹jQuery validation插件一個(gè)新的校驗(yàn)規(guī)則屬性rangelength,通過(guò)數(shù)組方式賦值。

這里我們舉例校驗(yàn)ListBox兩個(gè)規(guī)則:

?校驗(yàn)必選項(xiàng)

?選擇范圍在0~4項(xiàng)

界面代碼:

      
        <
      
      
        form 
      
      
        id
      
      
        ="form1"
      
      
         runat
      
      
        ="server"
      
      
        >
      
      
< div align ="center" >
< fieldset style ="width: 350px; height: 200px;" >
< table border ="0" cellpadding ="3" cellspacing ="3" >
< tr >
< td >
請(qǐng)選擇汽車類型:
</ td >
</ tr >
< tr >
< td >
< asp:ListBox ID ="lstCar" runat ="server" Rows ="5" SelectionMode ="Multiple" >
< asp:ListItem Value ="1" Text ="奔馳汽車" ></ asp:ListItem >
< asp:ListItem Value ="2" Text ="寶馬汽車" ></ asp:ListItem >
< asp:ListItem Value ="3" Text ="奧迪汽車" ></ asp:ListItem >
< asp:ListItem Value ="4" Text ="現(xiàn)代汽車" ></ asp:ListItem >
< asp:ListItem Value ="5" Text ="豐田汽車" ></ asp:ListItem >
</ asp:ListBox >
</ td >
</ tr >
< tr >
< td >
< asp:Button ID ="btnSubmit" runat ="server" Text ="提交" />
</ td >
</ tr >
</ table >
</ fieldset >
< div id ="message" class ="alertmsg" >
</ div >
</ div >
</ form >

腳本代碼:

      
        <
      
      
        head 
      
      
        id
      
      
        ="Head1"
      
      
         runat
      
      
        ="server"
      
      
        >
      
      
< title > Recipe17 </ title >
< script type ="text/javascript" src ="Scripts/jquery-1.4.1-vsdoc.js" ></ script >
< script type ="text/javascript" src ="Scripts/jquery.validate.js" ></ script >
< script type ="text/javascript" >
$(
function () {
$(
" #form1 " ).validate({
rules: {
lstCar: { required:
true , rangelength: [ 0 , 4 ] }
},
messages: {
lstCar: { required:
" 至少選擇一種車! " ,
rangelength:
" 選擇的范圍為零到四種車! "
}
},
errorLabelContainer: $(
" #message " )
});
});
</ script >
< style type ="text/css" >
.alertmsg
{
color
: #FF0000 ;
}
</ style >
</ head >

界面效果:

ASP.NET jQuery 食譜17 (通過(guò)使用jQuery validation插件校驗(yàn)ListBox)_第1張圖片




ASP.NET jQuery 食譜17 (通過(guò)使用jQuery validation插件校驗(yàn)ListBox)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 上栗县| 岱山县| 隆林| 浦北县| 保定市| 栾城县| 左权县| 庆安县| 永新县| 喀什市| 八宿县| 荥经县| 法库县| 镇安县| 奎屯市| 桐梓县| 肇源县| 方城县| 铜陵市| 铜鼓县| 海原县| 老河口市| 罗源县| 噶尔县| 汾西县| 临武县| 皮山县| 台北市| 普兰县| 红原县| 班戈县| 鄂州市| 股票| 滦平县| 灌云县| 林甸县| 长武县| 彭山县| 茶陵县| 竹北市| 新乡县|