日期:2014-05-17  浏览次数:20940 次

帮我完成一个循环
<%
for   i=1   to   rs.pagesize
if   rs.eof   then   exit   for
%>
<tr>
<td   colspan= "2 "   height= "20 "> <font   color= "#FFCC99 "   title= " <%=rs( "mv_name ")%> -- <%=rs( "mv_user ")%> "> <a   href= "play.asp?action=play&id= <%=rs( "mv_id ")%> "     target= "play "> <%=rs( "mv_name ")%> </a> </font> </td>
</tr>
<%rs.MoveNext%>
<%next%%>


然后我有一个style
<style>
<--
a:hover   {
text-decoration:   none;
color:   #99CC00;
}
-->
</style>


我想把这个style嵌在上面的循环里面     实现   奇数行记录的链接颜色为color:   #99CC00;       偶数行的链接颜色为color:   #999999;

我做了很多次     都不成功哦

<%for   h=1   to   rs.recordcount%>
.
.
.
<%next%>

应该是这样嵌套吧
具体怎么写呢

------解决方案--------------------
<style>
<--
a.class2:hover {
text-decoration: none;
color: #99CC00;
}
a.class1:hover {
text-decoration: none;
color: #999999;
}

-->
</style>


<%
for i=1 to rs.pagesize
if rs.eof then exit for
if (i mod 2) = 0 then
aclass = "class1 "
else
aclass = "class2 "
end if
%>
<tr>
<td colspan= "2 " height= "20 "> <font color= "#FFCC99 " title= " <%=rs( "mv_name ")%> -- <%=rs( "mv_user ")%> "> <a href= "play.asp?action=play&id= <%=rs( "mv_id ")%> " class= " <%=aclass%> " target= "play "> <%=rs( "mv_name ")%> </a> </font> </td>
</tr>
<%rs.MoveNext%>
<%next%%>