日期:2014-05-17 浏览次数:20413 次
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>无标题页</title> <script type="text/javascript"> window.onload = function(){ var chColleciton = document.getElementById("tb").getElementsByTagName("input"); var label; for(var i=0;i<chColleciton.length;i++){ if(chColleciton[i].type=="checkbox"&&chColleciton[i].checked){ label = chColleciton[i].nextSibling; while(label.nodeType!=1){ label = label.nextSibling; } alert(label.innerHTML) } } } </script> </head> <body> <table id="tb"> <tr> <td> <input id="DropDownCheckList2_0" type="checkbox" name="DropDownCheckList2:0" /><label for="DropDownCheckList2_0">Mystery</label> </td> </tr> <tr> <td> <input id="DropDownCheckList2_1" type="checkbox" checked="checked" name="DropDownCheckList2:0" /><label for="DropDownCheckList2_0">Myste66ry</label> </td> </tr> </table> </body> </html>