转自;https://www.cnblogs.com/zhenmingliu/archive/2012/05/15/2502270.html
1 <html> 2 <head> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 4 <title>js</title> 5 </head> 6 <script language="javascript"> 7 function aa(){ 8 var r=document.getElementsByName("r"); 9 for(var i=0;i<r.length;i++){ 10 if(r[i].checked){ 11 alert(r[i].value+","+r[i].nextSibling.nodeValue); 12 } 13 } 14 } 15 </script> 16 <body> 17 <form name="form1" method="post" action=""> 18 <input type="checkbox" name="r" value="1">a<br> 19 <input type="checkbox" name="r" value="2">b<br> 20 <input type="checkbox" name="r" value="3">c<br> 21 <input type="checkbox" name="r" value="4">d<br> 22 <input type="checkbox" name="r" value="5">e<br> 23 <input type="checkbox" name="r" value="6">f<br> 24 <input type="checkbox" name="r" value="7">g<br> 25 <input type="checkbox" name="r" value="8">h<br> 26 <input type="checkbox" name="r" value="9">i<br> 27 <input type="checkbox" name="r" value="10">j<br> 28 <br> 29 <input type="button" onclick="aa()" value="button"> 30 </form> 31 </body> 32 </html> 33 34 35 36 37 38 39 40 解释: 41 42 nextSibling是获得当前对象的下一个对象 43 nodeValue是返回一个节点的值