如何编写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>

标签:排行榜,top
0
投稿

猜你喜欢

  • 教你轻松了解MySQL数据库中的结果字符串

    2009-02-23 17:29:00
  • 用ASP读取/写入UTF-8编码格式的文件

    2007-08-20 09:29:00
  • SQL Server跟踪数据实现索引优化向导

    2009-02-13 17:14:00
  • 下一站:HandlerSocket!

    2011-04-11 09:02:00
  • 中文段首不需要空两格

    2010-04-23 20:31:00
  • 网页设计中怎么将px换成em

    2008-04-16 13:50:00
  • ASP格式化日期的函数(输出13种样式)

    2011-07-12 20:22:00
  • DOM_window对象属性之--clipboardData对象操作代码

    2011-02-05 10:49:00
  • 如何编写一个基于WEB的文件查询系统?

    2009-11-08 18:55:00
  • asp封装dll源码分享

    2008-09-25 17:20:00
  • 浏览器tab的设计

    2008-08-11 13:03:00
  • asp之自动闭合HTML/ubb标签函数 附简单注释

    2011-02-28 11:24:00
  • IE9四大渲染引擎模式

    2010-04-20 16:57:00
  • 悟透JavaScript

    2008-05-29 22:15:00
  • ASP 字符串转数字格式

    2009-08-19 17:18:00
  • ACCESS入门教程:用向导建立数据库

    2008-01-17 12:46:00
  • Opera Mini 5 网站开发速记

    2010-04-20 16:29:00
  • SQL语句练习实例之七 剔除不需要的记录行

    2011-11-03 16:50:51
  • 您需要了解的DIV+CSS网页布局的8条面试题目

    2010-01-29 13:22:00
  • MySQL字符集查看方法

    2010-12-14 15:14:00
  • asp之家 网络编程 m.aspxhome.com