jQuery自適應(yīng)輪播圖插件Swiper用法示例
1264
2024-02-20
checkbox批量選中,獲取選中項的值的簡單實例
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript" src="http://www.gimoo.net/t/1901/jquery.js"></script> </head> <body> <div id="table"> <table id="personList" border="1"> <tr> <th>ID</th> <th><input type="checkbox" name="allCheck" onclick="fun()"></input></th> <th>name</th> <th>age</th> <th>Country</th> </tr> <tr> <td>1</td> <th><input type="checkbox" name="checkme" id="a"></input></th> <td>asan</td> <td>32</td> <td>China</td> </tr> <tr> <td>2</td> <th><input type="checkbox" name="checkme" id="b3e"></input></th> <td>hon</td> <td>30</td> <td>JP</td> </tr> <tr> <td>3</td> <th><input type="checkbox" name="checkme" id="cdd"></input></th> <td>Jhone</td> <td>27</td> <td>USA</td> </tr> </table> </div> <input type="button" value="" onclick="s()" id="qw" name="aaa"/> <script> function fun(){ var obj = document.getElementsByName("checkme"); var arr = new Array(); for(var i=0;i<obj.length;i++){ obj[i].click(); arr[i]=$(obj[i]).parent().siblings().first().text(); alert(arr); } } function s(){ var obj = document.getElementsByName("checkme"); var arr = []; for(var i=0;i<obj.length;i++){ if($(obj[i]).is(':checked')){ var id = $(obj[i]).parent().siblings().first().text(); var name = $(obj[i]).parent().siblings().eq(1).text(); var age = $(obj[i]).parent().siblings().eq(2).text(); var country = $(obj[i]).parent().siblings().eq(3).text(); alert("id"+id+" ,name:"+name+" ,age:"+age+" ,country:"+country); //alert("$(obj[i]):"+$(obj[i])+" ,id:"+$(obj[i]).id+" ,name:"+$(obj[i]).name) } } } </script> </body> </html>
以上就是小編為大家?guī)淼腸heckbox批量選中,獲取選中項的值的簡單實例全部內(nèi)容了,希望大家多多支持綠夏網(wǎng)~
#免責(zé)聲明#
本站[綠夏技術(shù)導(dǎo)航]提供的一切軟件、教程和內(nèi)容信息僅限用于學(xué)習(xí)和研究目的;不得將上述內(nèi)容用于商業(yè)或者非法用途,否則,一切后果請用戶自負(fù)。本站信息來自網(wǎng)絡(luò)收集整理,版權(quán)爭議與本站無關(guān)。您必須在下載后的24個小時之內(nèi),從您的電腦或手機(jī)中徹底刪除上述內(nèi)容。如果您喜歡該程序或內(nèi)容,請支持正版,購買注冊,得到更好的正版服務(wù)。我們非常重視版權(quán)問題,如有侵權(quán)請郵件[admin@lxwl520.com]與我們聯(lián)系進(jìn)行刪除處理。敬請諒解!