<script language=javascript> <!--
function CheckAll() { for (var k=0;k<document.del.elements.length;k++) { var e = document.del.elements[k]; var check = document.del.allbox.checked; var tr=tr+[k+1]; if (e.name != 'allbox') { e.checked = document.del.allbox.checked; if(k<=15) //只有tr变量在tr1到tr16之间才执行行变色代码,否则超越行ID就会报错; { if(check) //如果全选框是选中的那么,所有行变色,否则取消变成原来色彩; { eval(tr).style.backgroundColor=#E7EFFF; } else { eval(tr).style.backgroundColor=#F7F3F7; } } } } }
function checkme(obj,tr) //选中哪行哪行变色,由点击本身触发事件; { if(obj.checked) tr.style.backgroundColor=#E7EFFF; else tr.style.backgroundColor=#F7F3F7; }
function chk_ondbl(tr,i) //如果双击行,那么对应的行变色,根据I值来选中对应的复选框; { if(tr.style.backgroundColor== || tr.style.backgroundColor==#f7f3f7) { tr.style.backgroundColor=#E7EFFF; document.del.id[i-1].checked=true; } else { tr.style.backgroundColor=#F7F3F7; document.del.id[i-1].checked=false; } } //-->
</script>
'--------------------------------------------------------------------------------------------主要实现的ASP程序代码
<%if not rs.eof then %> <% for i=1 to rs.pagesize%> <%pageno=(curpage-1)*rs.pagesize+i%> <tr bgcolor=#F7F3F7 id='<%=tr&i%>' onDblClick=chk_ondbl(<%=tr&i%>,<%=i%>);> <td height=25> <div align=center><%=pageno%></div></td> <td> <div align=left> <span class=style2 style2><a href=readweidang.asp?id=<%=rs(id)%> target=_blank><font color=black><%=rs(title)%></font> </a> </span></div></td> <td><div align=center><span class=style2 style2> <%a=split(rs(time), ) time1=a(0)
if trim(time1)<>trim(date()) then%> <span class=style5> <%else%> <span class=style8> <%end if%> <%response.write right(a(0),len(a(0))-2)%> </span></span></div></td> <td><div align=center><%=rs(click)%></div></td> <td><div align=center><%=rs(nowclick)%></div></td> <td> <div align=center> <font face=Arial, Helvetica, sans-serif> <%set rs1=server.createobject(adodb.recordset) rs1.openselect * from blb2 where id=&rs(lb)&,conn,3,3 %> <%=rs1(name)%></font></div></td> <td width=6%> <div align=center><a href=editnewss.asp?id=<%=rs(id)%>&page=<%=request(page)%>><img src=images/m_olds.gif width=21 height=14 border=0></a> </div></td> <td width=10%> <div align=center> <input name=id type=checkbox id='<%=ckeckbox&i%>' value=<%=rs(id)%> onclick=checkme(this,<%=tr&i%>);> </div></td> </tr> <%if not rs.eof then rs.movenext end if if rs.eof then exit for next%>
|