?? newjs.asp
字號:
<%Response.Buffer=true%>
<!--下面是調用方法:其中shu=10這個數字10用來控制首頁顯示的新聞條數,max=10則是用來控制每條新聞顯示的字數,你可以自行修改-->
<!-- 代碼開始:<script language="JavaScript" src="你的程序所在http目錄/newjs.asp?shu=10&max=10"></script>代碼結束 -->
<!-- 如果你在使用的時候有什么問題,請和我聯系,主頁地址: http://www.nxbbs.com 聯系email: xbb888@21cn.com QQ: 1776354 -->
<!--#include file="Connections/news.asp" -->
<%
dim shu,news,max,rs,sql,url,conn
url="http://www.nxbbs.com/news" '請修改你的程序所在目錄,結尾不要帶"/"號
if request.querystring("max")="" or request.querystring("max")=0 then
max=10
else
max=CINT(request.querystring("max"))
end if
if request.querystring("shu")="" or request.querystring("shu")=0 then
shu=10 '顯示數量
else
shu=CINT(request.querystring("shu"))
end if
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open MM_news_STRING
set rs=server.createobject("adodb.recordset")
sql ="SELECT * FROM news ORDER BY n_id DESC"
rs.open sql,conn,1,1
if rs.eof and rs.bof then %>
document.write('
<p align="center">對不起,暫時還沒有新聞</p>
');
<% else
news=1
do while not rs.eof
id=rs("n_id")
title=replace(rs("n_title"),"'"," ")
data=rs("n_data")
hit=rs("n_hit")
i=rs("n_i")
com=rs("n_com")
%>
document.write('<table width="100%" height="15" border="0" cellspacing="0" cellpadding="0"><TR><TD><%if data>=date() then Response.Write("<image src="&url&"/images/arrow1.gif>") else Response.Write("<image src="&url&"/images/arrow.gif>") end if%> <%if i=true then Response.Write("<font color=#ff0000>[圖文]</font>")%><A HREF=<%=url%>/detail.asp?n_id=<%=id%> title="<%=title%> (<%=hit%>次) " target="_blank"><%if len(title)>max then%><%=left(title,max)%>...<%else%><%=title%><%end if%></a><%if com=true then Response.Write("<font color=#ff0000>[推]</font>")%></TD></TR></table>');
<% news=news+1
if news>shu then exit do
rs.movenext
loop
end if
Rs.Close
set Rs=nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -