问题描述
functioncheckAll(boolvalue){varallCheckBoxs=document.getElementsByName("isBuy");for(vari=0;i<allCheckBoxs.length;i++){if(allCheckBoxs[i].type=="checkbox")allCheckBoxs[i].checked=boolvalue;}functionselwhite(){white.getW(setwhite);}functionsetwhite(date){varmybody=document.getElementsByTagName("body")[0];varmytable=document.getElementById("mytable");varmytablebody=document.createElement("tbody");for(vari=0;i<date.length;i++){varNewTr=document.createElement("tr");varNewTd1=document.createElement("td");varNewTd2=document.createElement("td");varNewTd3=document.createElement("td");varNewTd4=document.createElement("td");varNewTd5=document.createElement("td");varNewTd6=document.createElement("td");varusername=document.createTextNode(date[i].userName);varprojectname=document.createTextNode(date[i].projectName);varsectionname=document.createTextNode(date[i].sectionName);varfilename=document.createTextNode(date[i].fileName);varwhiteId=document.createTextNode(date[i].whiteListId)NewTd1.appendChild(username);NewTd2.appendChild(projectname);NewTd3.appendChild(sectionname);NewTd4.appendChild(filename);varinput=document.createElement("input");input.setAttribute("type","checkbox");input.setAttribute("id","isBuy");input.setAttribute("name","isBuy");input.setAttribute("value",whiteId);//实验过whiteId有值NewTd5.appendChild(input);NewTd6.appendChild(whiteId);NewTr.appendChild(NewTd1);NewTr.appendChild(NewTd2);NewTr.appendChild(NewTd3);NewTr.appendChild(NewTd4);NewTr.appendChild(NewTd5);NewTr.appendChild(NewTd6);mytablebody.appendChild(NewTr);}mytable.appendChild(mytablebody);mybody.appendChild(mytable);mytable.setAttribute("align","center");}这个是html<td><inputtype="button"onClick="javascript:checkAll(true)"value="全选"><inputtype="button"onClick="javascript:checkAll(false)"value="全不选"></td><td><inputtype="button"onclick="document.getElementById('form1').submit()"value="删除"></td>处理页面Stringid[]=(String[])request.getParameterValues("isBuy");id[]为空怎么回事,请高手指点!
解决方案
解决方案二:
忘记说,我用了DWR