Name the checkbox: <input type='checkbox' name='checkTheme' value='">
When I submit it, I am onclick="aa();"
function aa() {var bb = "";var temp = "";var a = document.getElementsByName("checkTheme");for ( var i = 0; i < a.length; i++) {if (a[i].checked) {temp = a[i].value;bb = bb + "," +temp;}}document.getElementById("tempString").value = bb.substring(1, bb.length);}Put an input hidden property in the jsp page to receive the value in aa():
<input type="hidden" id="tempString" name="tempString" />
In action:
private String tempString;//get, set methods
String temp1[] = tempString.split(",");// Intercept the string and get the values of each checkBox
The value in this array temp1[] is the value obtained in each check box to be obtained
The above JS article obtains the value of the checkbox and passes it to the background is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.