<script language="JavaScript">
function check(field) {
var t = document.noticeForm.selectAll;
if(!document.noticeForm.notice.length){
if(t.checked){
document.noticeForm.notice.checked=true;
}
else{
document.noticeForm.notice.checked=false;
}
}
if (t.checked) {
for (i = 0; i <field.length; i++) {
field[i].checked = true;
}
}
else {
for (i = 0; i <field.length; i++) {
field[i].checked = false;
}
}
}
function isSelect(confirmString){
field = document.noticeForm.notice;
var count = 0;
if(!document.noticeForm.notice.length){
if(document.noticeForm.notice.checked){
count++;
}
}
for (i = 0; i <field.length; i++) {
if(field[i].checked == true){
++count;
}
}
alert(count);
if(count>0){
return confirm(confirmString);
}
else {
alert('請(qǐng)至少選擇一個(gè)!');
return false;
}
}
</script>
<form action="${action}" name="noticeForm" onsubmit="return isSelect('${confirmString}');">
<table border="1" width="95%" bordercolor="#8AB78A">
<tr>
<td align="center"><input type="checkbox" name="" onClick="check(this.form.notice)"/></td>
<td align="center"><strong>狀態(tài)</strong></td>
<td align="center"><strong>標(biāo)題</strong></td>
<td align="center"><strong>作者</strong></td>
<td align="center"><strong>發(fā)給誰?</strong></td>
<td align="center"><strong>人氣/回復(fù)</strong></td>
<td align="center"><strong>發(fā)布時(shí)間</strong></td>
<td align="center"><strong>最后修改</strong></td>
<td align="center"><strong>審核</strong></td>
</tr>
<c:forEach var="notice" items="${pageForm.list}" begin="${(pageForm.currentPage-1)*(pageForm.pageSize)}" end="${(pageForm.currentPage-1)*(pageForm.pageSize)+pageForm.pageSize-1}">
<tr align="center">
<td><input type="checkbox" name="notice" value="${notice.id}"/></td>
<td><c:out value="${notice.statusString}"></c:out></td>
<td>
<a href="servlet/NoticeDetail?id=${notice.id}" title="${notice.title}">
<c:out value="${notice.title}"></c:out>
</a>
<fmt:formatDate var="writeTime" value='${notice.writeTime}' type='both' pattern="yyyy-MM-dd"/>
<jsp:useBean id="now" class="java.util.Date" />
<fmt:formatDate var="today" value="${now}" type="both" pattern="yyyy-MM-dd" />
<c:if test="${writeTime==today}">
<img alt="新公告" src="images/new.gif">
</c:if>
</td>
<td><c:out value="${notice.authorId}"></c:out></td>
<c:set var="author" value="${notice.authorId}"></c:set>
<td><c:out value="${notice.typeString}"></c:out>
<c:out value="(${notice.recipients})"></c:out></td>
<td><c:out value="${notice.readCount}"></c:out>/<c:out value="${notice.replyCount}"></c:out></td>
<td>
<fmt:formatDate value='${notice.writeTime}' type='both' pattern="yyyy-MM-dd HH:mm:ss"/>
</td>
<td>
<fmt:formatDate value='${notice.lastModified}' type='both' pattern="yyyy-MM-dd HH:mm:ss"/>
</td>
<td>
<c:out value="${notice.isAuditString}"></c:out>
</td>
</tr>
</c:forEach>
</table>
<input type="checkbox" name="selectAll" value="全選" onClick="check(this.form.notice)">全選
<input type="image" src="images/delete.gif" style="cursor: hand;" alt="刪除" >刪除選定內(nèi)容