This article mainly shares with you how to use js to obtain the value of the checkbox. I hope it can help you.
<input type="checkbox" name="test" value="值1" />显示的内容 <input type="checkbox" name="test" value="值2" />显示的内容 <input type="checkbox" name="test" value="值3" />显示的内容 <input type="checkbox" name="test" value="值n" />显示的内容 .... <input type="button" value="提交" onclick="send()" /> JS: function send(){ var id = document.getElementsByName('test'); var value = new Array(); for(var i = 0; i < id.length; i++){ if(id[i].checked) value.push(id[i].value); } window.location ='某Action!netWorkingUpdate?concentratorids='+value.toString();
Backend:
String value = request.getParameter("concentratorids");
Then intercept this value
Related recommendations:
##js gets select Detailed explanation of the method of tag value value
jQuery implementation method of obtaining the value value of the selected option
PHP Accumulation of value values of the same key in multi-dimensional arrays function
The above is the detailed content of Use js to get the value of checkbox. For more information, please follow other related articles on the PHP Chinese website!