?? topx-ent.asp
字號(hào):
<!--#include file="set.asp" -->
<!--#include file="function.asp" -->
<%
On Error Resume Next
Server.ScriptTimeOut=10
'*********頁(yè)面設(shè)置部分***********************************************************************
const m=10 '首頁(yè)列出多少條新聞
const NeedTime=False '是否需要顯示時(shí)間,True 表示顯示時(shí)間 , False 表示不顯示時(shí)間
const NewsLength=8 '新聞標(biāo)題截取長(zhǎng)度(不包括時(shí)間),注意截取了新聞長(zhǎng)度就不能顯示新聞時(shí)間
const ShowTypeX="娛樂" '您希望顯示的分類,用逗號(hào)隔開,共有以下幾類:娛樂,體育,科技,財(cái)經(jīng),社會(huì),汽車,影音,國(guó)內(nèi),國(guó)際,文教
const NewsExTime=4 '多少秒重新取一次數(shù)據(jù)
'*********************************************************************************************
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,"<!--新聞開始-->","<!--新聞結(jié)束-->",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 "joynewsent.innerHTML=""<table border=0 cellspacing=0 cellpadding=2 >"&News&"</table>"""
End sub
call GetHttpNews()
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -