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

猜你喜欢

  • 用 Python 制作地球仪的方法

    2022-11-10 19:10:36
  • 详解scratch3.0二次开发之scratch-blocks中的blocks的类型、定义和使用方法

    2023-10-18 06:02:09
  • Python模块学习 datetime介绍

    2023-08-15 16:01:18
  • 实现asp长文章自动分页插件

    2011-02-26 13:51:00
  • python利用matplotlib库绘制饼图的方法示例

    2022-12-17 15:16:50
  • python中用shutil.move移动文件或目录的方法实例

    2021-01-03 07:35:06
  • asp Server对象之MapPath方法

    2010-07-07 12:28:00
  • python3.6的venv模块使用详解

    2023-05-11 12:13:41
  • python中requests和https使用简单示例

    2021-03-16 16:14:35
  • python3.9和pycharm的安装教程并创建简单项目的步骤

    2021-06-18 05:34:16
  • 极致之美——百行代码实现全新智能语言Lisp

    2010-07-13 13:07:00
  • Pandas+Matplotlib 箱式图异常值分析示例

    2022-09-19 08:49:39
  • 详解vue中的computed的this指向问题

    2024-04-27 15:46:56
  • 图文详解Python中如何简单地解决Microsoft Visual C++ 14.0报错

    2021-09-09 02:16:48
  • Mysql主键和唯一键的区别点总结

    2024-01-15 10:36:36
  • Trie树_字典树(字符串排序)简介及实现

    2022-02-22 23:18:23
  • matplotlib 纵坐标轴显示数据值的实例

    2021-10-02 12:55:43
  • 总结python爬虫抓站的实用技巧

    2022-07-07 05:04:09
  • linux下安装mysql简单的方法

    2024-01-19 21:02:46
  • Python中的xlrd模块使用原理解析

    2021-07-24 14:25:21
  • asp之家 网络编程 m.aspxhome.com