復制代碼 代碼如下:
<script type="text/javascript">
function delWork(id){
var boxes = document.getElementsByName("commonPage.idBox");
var selected = new Array();
for (var i=0; i<boxes.length; i++) {
if(boxes[i].checked){
//push()把一個元素添加到數組的尾部
selected.push(boxes[i].value);
}
}
// join()方法將數組中的所有元素轉換成字符串,然後連接起來,這剛好和String的split()方法是一個相反的操作。join()默認是使用“,”作為分隔符,當然你也可以在方法中指定分隔符
var idStr = selected.join();
if(idStr == ''){
alert('還沒有選擇班次!');
return false;
}
if(confirm('確定要刪除選中的記錄?')){
var url = '${webRoot}/base/marquee/work-delete.action?commonPage.idBox='+idStr;
var myAjax = new Ajax.Request(url, {method:"post", onComplete:callback, asynchronous:true});
}
}
function callback(response){
alert(response.responseText);
//var url = "${webRoot}/base/marquee/work-queryWorks.action";
var url = "${webRoot}/base/marquee/workQuery.action";
window.location.href = url;
window.parent.document.getElementById("info").src = "";
}
</script>