?? topx.asp
字號:
<!--#include file="set.asp" -->
<!--#include file="function.asp" -->
<%
On Error Resume Next
Server.ScriptTimeOut=10
'*********頁面設置部分***********************************************************************
const m=20 '首頁列出多少條新聞
const NeedTime=False '是否需要顯示時間,True 表示顯示時間 , False 表示不顯示時間
const NewsLength=18 '新聞標題截取長度(不包括時間),注意截取了新聞長度就不能顯示新聞時間
const ShowTypeX="國內,國際,娛樂,體育,社會,財經,科技,文教,影音,汽車" '您希望顯示的分類,用逗號隔開,共有以下幾類:娛樂,體育,科技,財經,社會,汽車,影音,國內,國際,文教
const NewsExTime=60 '多少秒重新取一次數據
'*********************************************************************************************
Sub GetHttpNews()
Dim fso, f ,n , DateLastModified , wstr , pstr ,News
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(Server.MapPath("Template/news.htm"))
DateLastModified = cdate(f.DateLastModified)
Set f = nothing
Set fso= nothing
If DateDiff("s",DateLastModified,Now())>NewsExTime then
pstr=GetPage("http://news.sina.com.cn/news1000/index.shtml")
wstr = GetContent(pstr,"<!--新聞開始-->","<!--新聞結束-->",0)
wstr = Replace(wstr,"<ul>","")
wstr = VirtualURL(wstr,HomePage&"show.asp?url=")
wstr=Replace(wstr,"""","")
wstr=Replace(wstr,"'","’")
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(Server.MapPath("Template/news.htm"))
f.WriteLine wstr
f.close
set f = nothing
set fs = nothing
Else
wstr = ReadAllTextFile("Template/news.htm")
End if
str=split(wstr,"<li>")
for i=1 to Ubound(str)
If n<m then
If Instr(ShowTypeX,Mid(str(i),2,2))>0 then
News=News&"<tr><td>"&LeftNews(str(i),NewsLength,false)&"</td></tr>"
n=n+1
End if
End if
Next
Erase str
News=Replace(News,chr(10),"")
News=Replace(News,chr(13),"")
News=Replace(News,chr(10)&chr(13),"")
Response.Write "joynews.innerHTML=""<table border=0 cellspacing=0 cellpadding=2 >"&News&"</table>"""
End sub
call GetHttpNews()
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -