如何编写TOP10之类的排行榜?
来源:asp之家 发布时间:2009-11-07 18:45:00
下面我们以论坛排行榜举例说明:
<% @ LANGUAGE="VBSCRIPT" %>
<% OPTION EXPLICIT %>
<!--#include file="DataConn.asp"-->
<!--#include file="FuncSet.asp"-->
<% dim rs,sql,IDa,IDb,s,RegUser,a,b,c
Set rs=Server.CreateObject("ADODB.recordset")
sql="Select * from UserInfo ORDER BY iPerience DESC"
rs.Open sql,ConnStr,1,1
RegUser=rs.RecordCount
IDa=1
IDb=2
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="pragma" content="no-cache">
<link rel="stylesheet" type="text/css" href="Site.css">
<title>TOP10 排行榜 asp例子 - asp之家</title>
</head>
<body class="detail">
<table border="0" width="70%" cellpadding="0" align="center">
<tr>
<td width="16%" bgcolor="#FFFFFF" align="center"><font color="#0000A0">名次</font></td>
<td width="16%" class="Listline" align="center"><font color="#0000A0">网名</font></td>
<td width="17%" class="Listline" align="center"><font color="#0000A0">帖数</font></td>
<td width="17%" bgcolor="#FFFFFF" align="center"><font color="#0000A0">名次</font></td>
<td width="17%" class="Listline" align="center"><font color="#0000A0">网名</font></td>
<td width="17%" class="Listline" align="center"><font color="#0000A0">帖数</font></td>
</tr>
<% if RegUser<10 then
a=RegUser/2
else
a=5
end if
for s=1 to a
%>
<tr>
<td width="16%" bgcolor="#FFFFFF" align="center" valign="bottom"><font size="2"
color="#0000A0"><b><%=IDa%></b></font> </td>
<td class="Listline" align="center" style="cursor:hand" onmouseup="window.open('UserInfo.asp?UserName=<%=rs("UserName")%>','Call','width=350,height=400,left=300,top=100,toolbar=no,status=no')"><font color=#0000CC><%=rs("UserName")%></font></td>
<td class="Listline" align="center"><%=rs("iPerience")%></td>
</td>
<%rs.movenext%>
<td width="17%" bgcolor="#FFFFFF" align="center" valign="bottom"><font size="2"
color="#0000A0"><b><%=IDb%></b></font> </td>
<td class="Listline" align="center" style="cursor:hand" onmouseup="window.open('UserInfo.asp?UserName=<%=rs("UserName")%>','Call','width=350,height=400,left=300,top=100,toolbar=no,status=no')"><font color=#0000CC><%=rs("UserName")%></font></td>
<td class="Listline" align="center"><%=rs("iPerience")%></td>
</tr>
<%
IDa=IDa+2
IDb=IDb+2
rs.movenext
next
%>
<% if RegUser>20 then
for b=11 to 15 %>
<td class="Listline" align="center" style="cursor:hand" onmouseup="window.open('UserInfo.asp?UserName=<%=rs("UserName")%>','Call','width=350,height=400,left=300,top=100,toolbar=no,status=no')"><font color=#0000CC><%=rs("UserName")%></font></td>
<% rs.movenext%>
<%
next
end if %>
<% if RegUser>20 then
for c=16 to 20 %>
<td class="Listline" align="center" style="cursor:hand" onmouseup="window.open('UserInfo.asp?UserName=<%=rs("UserName")%>','Call','width=350,height=400,left=300,top=100,toolbar=no,status=no')"><font color=#0000CC><%=rs("UserName")%></font></td>
<% rs.movenext%>
<%
next
end if %>
</table>
</body>
</html>
猜你喜欢
- 金额大小写转换的asp完全无错版本, 这个版本解决了小数位不能到分的问题,处理方式符合会计方式,值得推荐!<!--#inc
- 作者的blog:http://www.planabc.netz-index属性简介引用:z-index : auto | numberaut
- 从概念上讲,大多数关系数据库系统都是类似的:它们都由一组数据库组成,且每个数据库都包含一组表。但是,所有的系统都有自己的管理数据的方法, M
- 比如 <div><img .../></div>想通过对这个div设置透明度来达到调整图片的透明度如果不
- asp如何显示全部的环境变量?<%@Language="VBScript"%><%dim H
- 简介Simon Willison来自英国,是一名经验丰富的开发人员。曾工作于Yahoo,是Web开发框架Django的创始人之一,也是Ope
- 要下午传上的.结果事一多,忘记了.好不容易回来 . 这个和 dh20156 的那个,是差不多的。 找不到合适的图片,也
- 一条语句搞定数据库分页select top 10 b.* from (select&nbs
- 笔者通过一周的时间,询问了许多设计人员真实用户,以便确保这六个方面确实是大多数用户所不喜并且有非常大的概率普遍存在于众多的医疗网站之中。那么
- bookheader.asp Recommended Books for <%=session(&quo
- 关于oracle 优化的内容很多,概念庞杂,不过可以总结出一个大纲性的东西作为需要考虑的方向,然后再逐步细化。oracle优化按重要性需要考
- 如何做一个随机密码产生器?<%genPassword = ""RandomizeFor&nbs
- 有些 SQL Server 2000 Personal Edition 实例和 SQL Server 2000 Desktop Engine
- 下面是一些有助于更有效地使用 SQL 事件探查器的提示和技巧。运行的跟踪过多如果 Microsoft? SQL Server? 实例运行得过
- 内容摘要:在网页制作中,有许多的术语,例如:CSS、HTML、DHTML、XHTML等等。在下面的文章中我们将会用到一些有关于HTML的基本
- 摘 要: 恢复丢失的数据库文件在很大程度上取决于所采用的备份策略。本文从恢复的灵活性出发,对Oracle8数据库的备份及恢复策略进行了探讨,
- Windows下ORACLE完全卸载:使用OUI可以卸载数据库,但卸载后注册表和文件系统内仍会有部分残留。这些残留不仅占用磁盘空间,而且影响
- 内容摘要:最近逛论坛经常看到有朋友问上传文件怎么重命名,怎么以当前日期来重命名上传文件。现在我就介绍一下重命名的方法,希望对大家有所帮助。本
- 我们提倡尽可能使用CSS,而且我们常常能做到这一点。现代浏览器有很好的CSS支持-这无疑足够好让你使用CSS来控制布局和版面设计。但是有时候
- 一、密码式给数据库起一个随机复杂的名称,避免被猜到被下载,这种方式在以前很流行,因为大家都对自己的代码很有自信。但随着错误提示对数据库地址的