<div class="codetitle"> <span><a style="CURSOR: pointer" data="67362" class="copybut" id="copybut67362" onclick="doCopy('code67362')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code67362"> <br><script type="text/javascript"> <BR>function delWork(id){ <BR>var boxes = document.getElementsByName("commonPage.idBox"); <BR>var selected = new Array(); <BR>for (var i=0; i<boxes.length; i++) { <BR>if(boxes[i].checked){ <BR>//push()把一个元素添加到数组的尾部 <BR>selected.push(boxes[i].value); <BR>} <BR>} <BR>// join()方法将数组中的所有元素转换成字符串,然后连接起来,这刚好和String的split()方法是一个相反的操作。join()默认是使用“,”作为分隔符,当然你也可以在方法中指定分隔符 <BR>var idStr = selected.join(); <BR>if(idStr == ''){ <BR>alert('还没有选择班次!'); <BR>return false; <BR>} <br><br>if(confirm('确定要删除选中的记录?')){ <br><br>var url = '${webRoot}/base/marquee/work-delete.action?commonPage.idBox='+idStr; <BR>var myAjax = new Ajax.Request(url, {method:"post", onComplete:callback, asynchronous:true}); <br><br>} <BR>} <br><br>function callback(response){ <BR>alert(response.responseText); <BR>//var url = "${webRoot}/base/marquee/work-queryWorks.action"; <BR>var url = "${webRoot}/base/marquee/workQuery.action"; <BR>window.location.href = url; <br><br>window.parent.document.getElementById("info").src = ""; <BR>} <br><br></script> <br> </div>