如何统计考勤:这段ASP代码怎么设置一行显示6张图片?
来源:百度文库 编辑:中科新闻网 时间:2024/05/10 18:37:32
<%
Do While Not oRs.Eof
Response.Write "<tr>"
For CoolNum = 0 to 3
%>
<td width="25%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><a href="CoolSiteShow.asp?CoolSiteID=<%=oRs("C_ID")%>" target="_blank"><img src="<%=oRs("C_SitePicS")%>" alt="酷站名称:<%=oRs("C_SiteName")&vbcrlf%>点击次数:<%=oRs("C_SiteCount")%>次" width="100" height="100" border="0"></a></div></td>
</tr>
<tr>
<td><div align="center"><a href="CoolSiteShow.asp?CoolSiteID=<%=oRs("C_ID")%>" title="酷站名称:<%=oRs("C_SiteName")&vbcrlf%>点击次数:<%=oRs("C_SiteCount")%>次" target="_blank"><%=oRs("C_SiteName")%></a></div></td>
</tr>
</table>
</td>
<%
oRs.MoveNext
If oRs.Eof then
If CoolNum = 0 Then
Response.Write "<td width='50%'> </td>"
End if
Exit For
End If
Next
Response.Write "</tr>"
Loop
%>
</table>
加个计数器变量进去,初始值为0,在循环过程中累加计数器直,一旦计数器值到达6,则加入换行标记。
你的程序我没仔细看。但是大致做法如下:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
dim n
n=0
Do While Not oRs.Eof
Response.Write "<tr>"
For CoolNum = 0 to 3
%>
<td width="25%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><a href="CoolSiteShow.asp?CoolSiteID=<%=oRs("C_ID")%>" target="_blank"><img src="<%=oRs("C_SitePicS")%>" alt="酷站名称:<%=oRs("C_SiteName")&vbcrlf%>点击次数:<%=oRs("C_SiteCount")%>次" width="100" height="100" border="0"></a></div></td>
</tr>
<tr>
<td><div align="center"><a href="CoolSiteShow.asp?CoolSiteID=<%=oRs("C_ID")%>" title="酷站名称:<%=oRs("C_SiteName")&vbcrlf%>点击次数:<%=oRs("C_SiteCount")%>次" target="_blank"><%=oRs("C_SiteName")%></a></div></td>
</tr>
</table>
</td>
<%
oRs.MoveNext
If oRs.Eof then
If CoolNum = 0 Then
Response.Write "<td width='50%'> </td>"
End if
Exit For
End If
Next
n=n+1
if n=6 then
Response.Write "</tr>"
n=0
end if
Loop
%>
</table>
加个计数器变量进去,初始值为0,在循环过程中累加计数器直,一旦计数器值到达6,则加入换行标记。
你的程序我没仔细看。但是大致做法如下:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
dim n
n=0
Do While Not oRs.Eof
Response.Write "<tr>"
For CoolNum = 0 to 3
%>
<td width="25%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><a href="CoolSiteShow.asp?CoolSiteID=<%=oRs("C_ID")%>" target="_blank"><img src="<%=oRs("C_SitePicS")%>" alt="酷站名称:<%=oRs("C_SiteName")&vbcrlf%>点击次数:<%=oRs("C_SiteCount")%>次" width="100" height="100" border="0"></a></div></td>
</tr>
<tr>
<td><div align="center"><a href="CoolSiteShow.asp?CoolSiteID=<%=oRs("C_ID")%>" title="酷站名称:<%=oRs("C_SiteName")&vbcrlf%>点击次数:<%=oRs("C_SiteCount")%>次" target="_blank"><%=oRs("C_SiteName")%></a></div></td>
</tr>
</table>
</td>
<%
oRs.MoveNext
If oRs.Eof then
If CoolNum = 0 Then
Response.Write "<td width='50%'> </td>"
End if
Exit For
End If
Next
n=n+1
if n=6 then
Response.Write "</tr>"
n=0
end if
Loop
%>