解决问题,高分100送??

vbzc 2002-07-24 10:32:14
我的动网论坛的首页链接代码好像有问题,下面是原首页调用的asp文件的源代码:
<!--#include file="conn.asp"-->
<%
function HTMLEncode(fString)

fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = replace(fString, ";", ";")
fString = replace(fString, "'", "‘")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), ";")
fString = Replace(fString, CHR(10), ",")
HTMLEncode = fString
end function
dim rs,sql
if request("orders")=1 then
orders="hits"
else
orders="DateAndTime"
end if
if request("reply")=1 then
reply=""
else
reply=" parentid=0 and "
end if
set rs=server.createobject("adodb.recordset")
if request("boardid")="all" then
sql="select top "&request("n")&" username,topic,announceid,boardid,rootid,hits from bbs1 where "&reply&" datediff('d',dateandtime,Now())>="&request("sdate")-1&" and not locktopic=2 ORDER BY "&orders&" desc"
else
sql="select top "&request("n")&" username,topic,announceid,boardid,rootid,hits from bbs1 where "&reply&" datediff('d',dateandtime,Now())>="&request("sdate")-1&" and not locktopic=2 and boardid="&request("boardid")&" ORDER BY "&orders&" desc"
end if
rs.open sql,conn,1,1
do while Not RS.Eof
response.write "document.write('<FONT color=#b70000><B>·</B></FONT><span style=""font-size:9pt;line-height: 15pt""><a href=dispbbs.asp?boardid="&rs(3)&"&RootID="&rs(4)&"&ID="&rs(2)&" target=_top title="&htmlencode(rs(1))&">');"

if len((rs("topic")))>Cint(request("tlen")) then
response.write "document.write('"&htmlencode(left(rs(1),request("tlen")))&"...');"
else
response.write "document.write('"&htmlencode(rs(1))&"');"
end if

response.write "document.write('</a>');"
select case request("info")
case 0

case 1
response.write "document.write('(<a href=dispuser.asp?name="&rs(0)&" target=_blank>"&rs(0)&"</a>,<font color=green>"&rs(5)&"</font>)');"
case 2
response.write "document.write('(<font color=green>"&rs(5)&"</font>)');"
case 3
response.write "document.write('(<a href=dispuser.asp?name="&rs(0)&" target=_blank>"&rs(0)&"</a>)');"
case else

end select

response.write "document.write('</span><br>');"
RS.MoveNext
Loop
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

运行首页总是网页上有问题,什么都没有,首页调用是空的,请高手解决!!
...全文
65 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
vbzc 2002-07-28
当然有数据,没数据论坛怎么可以浏览数据呢?看看我的论坛吧:http://wlfhbbs.yeah.net
回复
myt9527 2002-07-28
还不给分???
回复
myt9527 2002-07-28
问题出在下面这段代码
response.write "document.write('<FONT color=#b70000><B>·</B></FONT><span style=""font-size:9pt;line-height: 15pt""><a href=dispbbs.asp?boardid="&rs(3)&"&RootID="&rs(4)&"&ID="&rs(2)&" target=_top title="&htmlencode(rs(1))&">');"
ASP中response.write ""里面再套用引号用单引号,再在里面套用引号时你用“就会出问题,可以考虑用转义符或干脆写个函数就行了:
<script language="JavaScript">
function restyle(){
return "font-size:9pt;line-height: 15pt"
}</script>
.....
response.write "document.write('<FONT color=#b70000><B>·</B></FONT><span style="restyle()"><a href=dispbbs.asp?boardid="&rs(3)&"&RootID="&rs(4)&"&ID="&rs(2)&" target=_top title="&htmlencode(rs(1))&">');"
回复
vbzc 2002-07-24
有数据,错误信息就是网页上有问题.
回复
lanying 2002-07-24
数据库利没纪录!
回复
freezwy 2002-07-24
你的数据库中有数据吗?
错误信息是什么?
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告