100分高分求解新手问题!!
lzt7 2004-08-11 04:25:12 2.asp的是用来显示用户排行的,源代码如下:
<%
sub ShowTopUser(UserNum)
if UserNum<=0 or UserNum>100 then UserNum=10
dim sqlTopUser,rsTopUser,i
sqlTopUser="select top " & UserNum & " * from " & db_User_Table & " order by " & db_User_ArticleChecked & " desc," & db_User_ID & " asc"
set rsTopUser=server.createobject("adodb.recordset")
rsTopUser.open sqlTopUser,Conn_User,1,1
if rsTopUser.bof and rsTopUser.eof then
response.write "没有任何用户"
else
response.write "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='left'>名次</td><td align='left'>用户名</td><td align='right'>文章数</td></tr>"
for i=1 to rsTopUser.recordcount
response.write "<tr><td align='center'>" & cstr(i) & "</td><td align='left'><a href='UserInfo.asp?UserID=" & rsTopUser(db_User_ID) & "'>" & rsTopUser(db_User_Name) & "</a></td><td align='right'>" & rsTopUser(db_User_ArticleChecked) & "</td></tr>"
rsTopUser.movenext
next
response.write "</table><div align='right'><a href='UserList.asp'>more...</a></div>"
end if
set rsTopUser=nothing
end sub
%>
然后在1.asp页面用<%call ShowTopUser(10)%>调用ShowTopUser函数
但现在我想改成用<script src='2.asp'></script>调用用户排行,请问2.asp页面该如何改?
下面是我改过后的2.asp页面,直接显示是没问题的,但用<script src='2.asp'></script>调用就什么耶没显示,为什么呢?是哪里出错了?
<%
dim usernum
usermum=10
if UserNum<=0 or UserNum>100 then UserNum=10
dim sqlTopUser,rsTopUser,i
sqlTopUser="select top " & UserNum & " * from " & db_User_Table & " order by " & db_User_ArticleChecked & " desc," & db_User_ID & " asc"
set rsTopUser=server.createobject("adodb.recordset")
rsTopUser.open sqlTopUser,Conn_User,1,1
if rsTopUser.bof and rsTopUser.eof then
response.write "document.write('没有任何用户')"
else
response.write "document.write('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td align=left>名次</td><td align=left>用户名</td><td align=right>文章数</td></tr>')"
for i=1 to rsTopUser.recordcount
response.write "document.write('<tr><td align=center>" & cstr(i) & "</td><td align=left><a href=UserInfo.asp?UserID=" & rsTopUser(db_User_ID) & ">" & rsTopUser(db_User_Name) & "</a></td><td align=right>" & rsTopUser(db_User_ArticleChecked) & "</td></tr>')"
rsTopUser.movenext
next
response.write "document.write('</table><div align=right><a href=UserList.asp>more...</a></div>')"
end if
set rsTopUser=nothing
%>