一个js示例

[url]来自
<body topmargin="5" leftmargin="3" bottommargin="5" rightmargin="0"><center><center>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form id="classListForm" name="classListForm" method="post">
<div align="center"><font size="3" color="black"><b>课程表</b></font></div>
<div style="padding-top:5px;padding-bottom:5px;width:100%" align=left>
<td>
<button property="new" value="新 增" οnclick="addClass();" styleClass="btn3_mouseout" style="btn3_mouseout" οnmοuseοver="this.className='btn3_mouseover'" οnmοuseοut="this.className='btn3_mouseout'" οnmοusedοwn="this.className='btn3_mousedown'" οnmοuseup="this.className='btn3_mouseup'" title="新 增">新 增</button> 
<button property="edit" value="修 改" οnclick="editClass();" styleClass="btn3_mouseout" style="btn3_mouseout" οnmοuseοver="this.className='btn3_mouseover'" οnmοuseοut="this.className='btn3_mouseout'" οnmοusedοwn="this.className='btn3_mousedown'" οnmοuseup="this.className='btn3_mouseup'">修 改</button> 
<button property="delete" value="删 除" οnclick="deleteClass();" styleClass="btn3_mouseout" style="btn3_mouseout" οnmοuseοver="this.className='btn3_mouseover'" οnmοuseοut="this.className='btn3_mouseout'" οnmοusedοwn="this.className='btn3_mousedown'" οnmοuseup="this.className='btn3_mouseup'">删 除</button>  
</td>
<td align=right>输入关键字:<input class="btn3_mouseout" style="btn3_mouseout" οnmοuseοver="this.className='btn3_mouseover'" οnmοuseοut="this.className='btn3_mouseout'" οnmοusedοwn="this.className='btn3_mousedown'" οnmοuseup="this.className='btn3_mouseup'" type=text name="keyword"> 
<button property="search" value="查 找" οnclick="findClass();" styleClass="btn3_mouseout" style="btn3_mouseout" οnmοuseοver="this.className='btn3_mouseover'" οnmοuseοut="this.className='btn3_mouseout'" οnmοusedοwn="this.className='btn3_mousedown'" οnmοuseup="this.className='btn3_mouseup'">查 找</button>
</td>
</div>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr bgcolor="#dddddd" align="center"><th width="6%" align="left"><input type='checkBox' onClick= "selectAllButDisabled(this.form)" class="btn3_mouseout" style="btn3_mouseout" οnmοuseοver="this.className='btn3_mouseover'" οnmοuseοut="this.className='btn3_mouseout'" οnmοusedοwn="this.className='btn3_mousedown'" οnmοuseup="this.className='btn3_mouseup'"><b style="color:black" align=center>全选</b></th>
<th width="20%"><b style="color:black" align=center>课程名称</b></th>
<th width="8%"><b style="color:black" align=center>任课老师</b></th>
<th width="7%"><b style="color:black" align=center>上课时间</b></th>
<th width="8%"><b style="color:black" align=center>下课时间</b></th>
<th width="8%"><b style="color:black" align=center>课程开始日期</b></th>
<th width="8%"><b style="color:black" align=center>课程有效日期</b></th>
<th width="40%"><b style="color:black" align=center>备注</b></th>
</tr>
<%
//声明一个DAO(IClassesDAO)接口,它的实现是ClassesDAO类,
//用这个接口可以实现查询数据库和获取数据记录,还可以进行增加、修改、删除等操作
IClassesDAO classesDAO = new ClassesDAO();
try{
//声明一个List集合,这个集合保存了数据库中的数据
List classList = classesDAO.getList();
%>

<%
int i = 0;
for( ; i < classList.size(); i++ ){
Classes clazz = ( Classes )classList.get( i );
%>
<tr>
<td><input type="checkbox" id="ClassId" name="ClassId" value="<%=clazz.getClassId()%>" onClick = "chkSelect(this.form)" class="btn3_mouseout" style="btn3_mouseout" οnmοuseοver="this.className='btn3_mouseover'" οnmοuseοut="this.className='btn3_mouseout'" οnmοusedοwn="this.className='btn3_mousedown'" οnmοuseup="this.className='btn3_mouseup'"/>
<c:out value="<%=i + 1%>"/>
</td>
<td><a href="JavaScript:updateClass('${class.classId}');" title="编辑"><%=clazz.getClassName()%></a></td>
<td><%=clazz.getTeacher()%></td>
<td><%=clazz.getStartTime()%></td>
<td><%=clazz.getEndTime()%></td>
<td><%=clazz.getStartDate()%></td>
<td><%=clazz.getEndDate()%></td>
<td><%=clazz.getRemark()%></td>
</tr>
<%
}
}catch( Exception e ){
e.printStackTrace();
}
finally{
classesDAO.close();
}
%>
</table>

</form>
</table>
</body>
♂天使♀(188784048) 17:08:26
function selectAll(theFrm) {
for (i=0 ;i< theFrm.elements.length;i++){
if (theFrm.elements[i].type=="checkbox") {
theFrm.elements[i].checked = event.srcElement.checked;
}
}
}

function deselectAll(theFrm) {
for (i=0 ;i< theFrm.elements.length;i++){
if ( theFrm.elements[i].type == "checkbox" ) {
if (!theFrm.elements[i].disabled) {
if (theFrm.elements[i].checked)
theFrm.elements[i].checked=false;
else
theFrm.elements[i].checked=true;
}
}
}
}

//
function selectAllButDisabled(theFrm) {
for (i=0 ;i< theFrm.elements.length;i++){
if ( theFrm.elements[i].type == "checkbox" && theFrm.elements[i].disabled == false ) {
theFrm.elements[i].checked = event.srcElement.checked;
}
}
}

function selectAllButReadonly(theFrm) {
for (i=0 ;i< theFrm.elements.length;i++){
if ( theFrm.elements[i].type == "checkbox" && theFrm.elements[i].readonly == false ) {
theFrm.elements[i].checked = event.srcElement.checked;
}
}
}

//¨o? ¤?¨ D???D
function chkSelect(theFrm) {
for (i=0 ;i< theFrm.elements.length;i++){
if ( theFrm.elements[i].type == "checkbox" ) {
if (theFrm.elements[i].checked) return true;
}
}
return false;
}
[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值