⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 js.asp

📁 旅游管理系统 用ASP+SQL 2
💻 ASP
字号:
<!--#include file="conn.asp" -->
<%
'请保留以下信息
dim kind, path,classID,NclassID
kind=1              			'首页调用类型,1表示新文章,2表示热门文章
const dateNum=100         		'列出多少天内的热门文章
const maxLen=20			'主题最多显示字数,字母算一个汉字算两个
const listNum=10			'显示多少个文章标题
const bullet=""			'标题前的图片或符号
const hitColor="red"		'点击数的颜色
const new_color="red"		'新文章日期的颜色
const old_color="gray"		'旧文章日期的颜色
ClassID=request.querystring("classid")               '指定首页调用文章分类ID,全部分类不填
NclassID=request.querystring("nclassid")
dim rs,sql,str,str1,topicLen,topic
Path="http://"&request.servervariables("server_name")&replace(request.servervariables("script_name"),"js.asp","")


function gotTopic(str,strlen)
	dim l,t,c, i
	l=len(str)
	t=0
	for i=1 to l
	c=Abs(Asc(Mid(str,i,1)))
	if c>255 then
	t=t+2
	else
	t=t+1
	end if
	if t>=strlen then
	gotTopic=left(str,i)&"..."
	exit for
	else
	gotTopic=str
	end if
	next
end function

set rs=server.createObject("Adodb.recordset")
sql="select top "&listNum&" * from article"

if NclassID<>"" then
	sql=sql&" where NclassID="&NclassID
elseif classID<>"" then
	sql=sql&" where classID="&classID
end if

if kind=2 then
	if nclassid="" and classID="" then
		sql=sql&" where"
	else
		sql=sql&" and"
	end if
end if

select case kind
	case "1" sql=sql&" order by articleid desc"
	case "2" sql=sql&" DATEDIFF('d',dateandtime,Now())<="&dateNum&" order by hits desc,title"
end select

rs.open sql,conn,3,3
if rs.bof and rs.eof then 
str=str+"没有符合条件的文章"
else

rs.movefirst
do while not rs.eof
	topic=gotTopic(rs("title"),maxLen)
	topic=replace(server.HTMLencode(topic)," ","&nbsp;")
	topic=replace(topic,"'","&nbsp;")
	str=str+bullet &" <img src=images/dot4.gif><font color=CD7C43></font><a href='"&Path&"list.asp?id="+Cstr(rs("articleid"))+"' target='_blank'  title='"&replace(replace(server.HTMLencode(rs("title"))," ","&nbsp;"),"'","&nbsp;")&"') >"+Topic+"</a> <font color=CD7C43>[</font>"
	
	str=str & "<font color=CD7C43 "
	if rs("dateandtime")>=date then
		str=str & new_color
 	else
		str=str & old_color
	end if
	str=str &"><font face=arial>" & Month(rs("DateAndTime"))&"</font>月<font face=arial>"&Day(rs("DateAndTime"))&"</font>日</font><font color=CD7C43>]</font><br>"

	rs.moveNext
loop
end if
rs.close : conn.close
set rs=nothing : set conn=nothing
response.write "document.write ("&Chr(34)&str&Chr(34)&");"
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -