The example of this article describes the method of getting the checkbox value from JS. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>js</title>
<script language= "JavaScript" >
function aa () {
var r=document.getelementsbyname ("R");
for (Var i=0;i<r.length;i++) {
if (r[i].checked) {
Alert (r[i].value+ "," +r[i].nextsibling.nodevalue);
}
}
}
</script>
<body>
<form name= "Form1" method= "Post" action= "" >
<input type= "checkbox" Name= "R" value= "1" >a<br>
<input type= "checkbox" Name= "R" value= "2" >b<br>
<input type= "checkbox" Name= "R" value= "3" >c<br>
<input type= "checkbox" Name= "R" value= "4" >d<br>
<input type= "checkbox" Name= "R" value= "5" >e<br>
<input type= "checkbox" Name= "R" value= "6" >f<br>
<input type= "checkbox" Name= "R" value= "7" >g<br>
<input type= "checkbox" Name= "R" value= "8" >h<br>
<input type= "checkbox" Name= "R" value= "9" >i<br>
<input type= "checkbox" Name= "R" value= "Ten" >j<br>
<br>
<input type= "button" onclick= "AA ()" value= "button" >
</form>
</body>
I hope this article will help you with your JavaScript programming.