%
dim rs, exec, s, url, port
const topNum=10 '首页调用留言数量
const maxLen=20 '首页调用留言标题字符长度限制
const old_color="666666" '旧留言日期的颜色
const new_color="red" '新留言日期的颜色
const showTime=true '是否显示日期显示设为true,不显示设为false
const showPic=true '是否显示用户名后的小图
const showname=true '是否显示用户名
port=request.servervariables("server_port")
url= "http://"&request.servervariables("server_name")
if (port<>80) then
url=url &":"& port
end if
url=url & replace(request.servervariables("script_name"),"js.asp","")
exec="select top "& topNum &" * from ly order by id desc"
set rs=conn.execute(exec)
if rs.eof then
s= "暂时没有留言!"
else
if showTime and showname and showpic then
do until rs.eof
s=s&"
"
if rs("rt")>0 then
s=s&"æ"
else
s=s&""
end if
if len(rs("title"))<=maxLen then
s=s&rs("title")
else
s=s&left(rs("title"),maxLen)&"..."
end if
s=s&" ("
if rs("t")>date then
s=s & "" & formatdatetime(rs("t"),2) & ","
else
s=s & ""& formatdatetime(rs("t"),2) & ","
end if
s=s & rs("name")
if rs("bl")=1 then
if isMaster(rs("name")) then
s=s&"
"
else
s=s&"
"
end if
end if
s=s& ")
"
rs.movenext
loop
elseif showTime and showname then
do until rs.eof
s=s&"
"
if rs("rt")>0 then
s=s&"æ"
else
s=s&""
end if
if len(rs("title"))<=maxLen then
s=s&rs("title")
else
s=s&left(rs("title"),maxLen)&"..."
end if
s=s&" ("
if rs("t")>date then
s=s & "" & formatdatetime(rs("t"),2) & ","
else
s=s & ""& formatdatetime(rs("t"),2) & ","
end if
s=s & rs("name")
s=s&")
"
rs.movenext
loop
elseif showname and showpic then
do until rs.eof
s=s&"
"
if rs("rt")>0 then
s=s&"æ"
else
s=s&""
end if
if len(rs("title"))<=maxLen then
s=s&rs("title")
else
s=s&left(rs("title"),maxLen)&"..."
end if
s=s&" ("
s=s & rs("name")
if rs("bl")=1 then
if isMaster(rs("name")) then
s=s&"
"
else
s=s&"
"
end if
end if
s=s&")
"
rs.movenext
loop
elseif showname then
do until rs.eof
s=s&"
"
if rs("rt")>0 then
s=s&"æ"
else
s=s&""
end if
if len(rs("title"))<=maxLen then
s=s&rs("title")
else
s=s&left(rs("title"),maxLen)&"..."
end if
s=s&" ("
s=s & rs("name")
s=s&")
"
rs.movenext
loop
elseif showtime then
do until rs.eof
s=s&"
"
if rs("rt")>0 then
s=s&"æ"
else
s=s&""
end if
if len(rs("title"))<=maxLen then
s=s&rs("title")
else
s=s&left(rs("title"),maxLen)&"..."
end if
s=s&" ("
if rs("t")>date then
s=s & "" & formatdatetime(rs("t"),2) & ""
else
s=s & ""& formatdatetime(rs("t"),2) & ""
end if
s=s&")
"
rs.movenext
loop
else
do until rs.eof
s=s&"
"
if rs("rt")>0 then
s=s&"æ"
else
s=s&""
end if
if len(rs("title"))<=maxLen then
s=s&rs("title")
else
s=s&left(rs("title"),maxLen)&"..."
end if
s=s&"
"
rs.movenext
loop
end if
end if
's=replace(s,"""","")
response.write "document.write('"&s&"');"
rsclose()
connclose()
%>