var documentStrIds=""
var chkUserInfos=document.getElementsByName("chkUserInfos")
for(var i=0i<chkUserInfos.lengthi++){
if(documentIds[i].checked){
documentStrIds+=chkUserInfos[i].value+""
flag=true//表示复选框有被选中的
}
}
if(flag){
window.location.href="......?documentStrIds="+documentStrIds //提交后台 别忘了传参
}
}
后台 读取documentStrIds
if(documentStrIds!=null &&!"".equals(documentStrIds.trim())){
String[] ids=documentStrIds.split("")
if(ids.length>0){
boolean flag=false
for(String idStr : ids){
//循环删除
}
}
}
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<select>
<option value="">请选择</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<button>clear</button>
</body>
<script>
document.querySelector("button").onclick = () => {
document.querySelector("select").value=""
}
</script>
</html>
请采纳
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)