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

📄 news.asp

📁 音乐类型的好网站
💻 ASP
字号:
<style>
td			{font-size:12px}
</style>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="center">&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td align="center"><a href="news.asp">最新新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=娱乐">娱乐新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=体育">体育新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=科技">科技新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=财经">财经新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=社会">社会新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=汽车">汽车新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=影音">影音新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=国内">国内新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=国际">国际新闻</a></td>
          <td align="center">│</td>
          <td align="center"><a href="news.asp?n=文教">文教新闻</a></td>
          <td align="center">&nbsp;&nbsp;&nbsp;&nbsp;</td>
        </tr>
      </table>
<p>&nbsp;</p>
<p>
  <%
Server.ScriptTimeOut=120

'*********页面设置部分***********************************************************************

const m=100				'每个分类的新闻最多几条

const NeedTime=False	'是否需要显示时间,True 表示显示时间 , False 表示不显示时间

const NewsLength=35		'新闻标题截取长度(不包括时间),注意截取了新闻长度就不能显示新闻时间

const Points="…"		'截取长度后的标题要跟的省略号样子,可不填。

'*********************************************************************************************

dim wstr,str,url,start,over,NewsClass,i
dim n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10
n0=0
n1=0
n2=0
n3=0
n4=0
n5=0
n6=0
n7=0
n8=0
n9=0
n10=0

NewsClass=trim(Request("n"))

	on error resume next 
	url="http://dailynews.sina.com.cn/news1000.shtml"				'新闻来源的页面
	wstr=getHTTPPage(url) 											'取得页面内容
	if err.number=0 then
		start=newstring(wstr,"<!--新闻开始-->")
		over=newstring(wstr,"<!--新闻结束-->")
		wstr=mid(wstr,start+11,over-start-11)
		wstr=replace(wstr,"href=""","href=""show.asp?url=")
		wstr=replace(wstr,"<ul>","")
		wstr=trim(replace(wstr,"</ul>",""))							'完成对页面内容的截取加工
		<!--隐藏新浪的地址start-->
		wstr=Replace(wstr,"http://news.sina.com.cn","NewsNews")
		wstr=Replace(wstr,"http://tech.sina.com.cn","TechNews")
		wstr=Replace(wstr,"http://sports.sina.com.cn","SportsNews")
		wstr=Replace(wstr,"http://ent.sina.com.cn","EntNews")
		wstr=Replace(wstr,"http://eladies.sina.com.cn","EladiesNews")
		wstr=Replace(wstr,"http://auto.sina.com.cn","AutoNews")
		wstr=Replace(wstr,"http://finance.sina.com.cn","FinanceNews")
		<!--隐藏新浪的地址 end -->
'		Set fs = CreateObject("Scripting.FileSystemObject") 
'		Set f = fs.CreateTextFile(server.mappath("mynews.htm"))		
'		f.writeLine wstr 
'		f.close 
'		set f = nothing 
'		set fs = nothing
		str=split(wstr,"<li>")
		If NewsClass<>"" then										'对分类新闻的截取
			for i=1 to Ubound(str)
				If Left(str(i),4)="["&NewsClass&"]" then
					News=News&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
				End if
			next
		Else														'对所有新闻进行分类
			for i=1 to Ubound(str)
				If     Left(str(i),4)="[娱乐]" then
					If n0<m then YuLe=YuLe&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n0=n0+1
				Elseif Left(str(i),4)="[体育]" then
					If n1<m then TiYu=TiYu&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n1=n1+1
				Elseif Left(str(i),4)="[国内]" then
					If n2<m then GuoNei=GuoNei&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n2=n2+1
				Elseif Left(str(i),4)="[科技]" then
					If n3<m then KeJi=KeJi&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n3=n3+1
				Elseif Left(str(i),4)="[财经]" then
					If n4<m then CaiJing=CaiJing&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n4=n4+1
				Elseif Left(str(i),4)="[社会]" then
					If n5<m then SheHui=SheHui&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n5=n5+1
				Elseif Left(str(i),4)="[汽车]" then
					If n6<m then QiChe=QiChe&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n6=n6+1
				Elseif Left(str(i),4)="[国际]" then
					If n7<m then GuoJi=GuoJi&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n7=n7+1
				Elseif Left(str(i),4)="[影音]" then
					If n8<m then YingYin=YingYin&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n8=n8+1
				Elseif Left(str(i),4)="[文教]" then
					If n9<m then WenJiao=WenJiao&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n9=n9+1
				Elseif Left(str(i),4)="[女性]" then
					If n10<m then NvXing=NvXing&"<li>"&LeftNews(str(i),NewsLength,NeedTime)
					n10=n10+1
				End if
				If Instr(str(i),"图文")>0 then
					TuWen=TuWen&"<li>"&LeftNews(str(i),8,False)
				End if
				
			next
		End if
		Erase str
	else 
		wscript.echo err.description 
	end if
	
	If Hour(Now())>17 then
		theDate=Date()
	Else
		theDate=DateAdd("d", -1, Date() )
	End if
		
	url="http://news.sina.com.cn/photo/imp/"&FormatDate(theDate,"-")&"/index.shtml"

	on error resume next 
	wstr=getHTTPPage(url) 
	if err.number=0 then
		start=newstring(wstr,"<!-- 图片列表 begin -->")
		over=newstring(wstr,"<!-- 图片列表 end -->")
		wstr=mid(wstr,start+20,over-start-20)
		<!--隐藏新浪的地址start-->
		wstr=Replace(wstr,"href=http://news.sina.com.cn","href=show.asp?url=NewsNews")
		wstr=Replace(wstr,"href=http://tech.sina.com.cn","href=show.asp?url=TechNews")
		wstr=Replace(wstr,"href=http://sports.sina.com.cn","href=show.asp?url=SportsNews")
		wstr=Replace(wstr,"href=http://ent.sina.com.cn","href=show.asp?url=EntNews")
		wstr=Replace(wstr,"href=http://eladies.sina.com.cn","href=show.asp?url=EladiesNews")
		wstr=Replace(wstr,"href=http://auto.sina.com.cn","href=show.asp?url=AutoNews")
		wstr=Replace(wstr,"href=http://finance.sina.com.cn","href=show.asp?url=FinanceNews")
		wstr=replace(wstr,"border=2","border=1")
		<!--隐藏新浪的地址 end -->
		str=split(wstr,"<a")
		Count=Ubound(str)
		for i=1 to Count
			If Instr(str(i),"更多图片>>")<=0 then
				If Instr(LL(str(i)),"<img")>0 then
				NewsImg=NewsImg&"⊙<a"&LL(str(i))
				Else
				NewsTitle=NewsTitle&"⊙<a"&LL(str(i))
				End if
			End if
		next
		Erase str
'		Set fs = CreateObject("Scripting.FileSystemObject") 
'		Set f = fs.CreateTextFile(server.mappath("mynews.htm"))		
'		f.writeLine wstr 
'		f.close 
'		set f = nothing 
	else 
		wscript.echo err.description 
	end if
	
	
	ArrayNewsImg=split(NewsImg,"⊙")
	ArrayNewsTitle=split(NewsTitle,"⊙")
	
	

%>
</p>
<table width="770" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td width="132" valign="top" align="center"> 
      <table border="0" cellspacing="0" cellpadding="4">
        <tr>
          <td align="center">图 片 新 闻</td>
        </tr>
        <%
		  For i=1 to cint( Count/4 ) -1 
		  Response.Write "<tr><td align=center >"&ArrayNewsImg(i)&"</td></tr><tr><td align=center >"&ArrayNewsTitle(i)&"</td></tr>"
		  Next
		  %>
      </table>
    </td>
    <td width="10"></td>
    <td valign="top"> 
      <% If NewsClass<>"" then %>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td   height="22"><b><%=NewsClass%>新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=News%></td>
        </tr>
      </table>
      <% Else %>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td   height="22"><b>娱乐新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=Replace(YuLe,"[娱乐]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>体育新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(TiYu,"[体育]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>科技新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(KeJi,"[科技]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>财经新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(CaiJin,"[财经]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>社会新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(SheHui,"[社会]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>汽车新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(QiChe,"[汽车]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>影音新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(YingYin,"[影音]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>国内新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(GuoNei,"[国内]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>国际新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(GuoJi,"[国际]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>文教新闻</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(WenJiao,"[文教]","")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr> 
          <td  height="22" ><b>女性专题</b></td>
        </tr>
        <tr> 
          <td class="line_t" style="LINE-HEIGHT: 200%""><%=replace(NvXing,"[女性]","")%></td>
        </tr>
      </table>
      <% End if %>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="10">
        <tr> 
          <td></td>
        </tr>
      </table>
    </td>
    <td width="10" valign="top"></td>
    <td width="132" valign="top" align="center"> 
      <table border="0" cellspacing="0" cellpadding="4">
        <tr>
          <td align="center">图 片 新 闻</td>
        </tr>
        <%
		  For i=cint( Count/4 ) to cint( Count/2 )-1
		  Response.Write "<tr><td align=center >"&ArrayNewsImg(i)&"</td></tr><tr><td align=center >"&ArrayNewsTitle(i)&"</td></tr>"
		  Next
		  %>
      </table>    
    </td>
  </tr>
</table>
<%
	function getHTTPPage(url) 
		on error resume next 
		dim http 
		set http=Server.createobject("Microsoft.XMLHTTP") 
		Http.open "GET",url,false 
		Http.send() 
		if Http.readystate<>4 then
			exit function 
		end if 
		getHTTPPage=bytes2BSTR(Http.responseBody) 
		set http=nothing
		if err.number<>0 then err.Clear  
	end function 

	Function bytes2BSTR(vIn) 
		dim strReturn 
		dim i,ThisCharCode,NextCharCode 
		strReturn = "" 
		For i = 1 To LenB(vIn) 
			ThisCharCode = AscB(MidB(vIn,i,1)) 
			If ThisCharCode < &H80 Then 
				strReturn = strReturn & Chr(ThisCharCode) 
			Else 
				NextCharCode = AscB(MidB(vIn,i+1,1)) 
				strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) 
				i = i + 1 
			End If 
		Next 
		bytes2BSTR = strReturn 
	End Function 
	
	Function newstring(wstr,strng)
		newstring=Instr(wstr,strng)
	End Function
	
	Function LeftNews(strng,NewsLength,NeedTime)
		If NeedTime<>True then
			Left_0=Instr(strng,"</a>")+3
			TheRed=Instr(strng,"<font color=#ff0000>")
			If TheRed>0 then
				Left_1=Instr(strng,"<font color=#ff0000>")+20
				Left_2=Instr(strng,"</font>")
				If Left_1+NewsLength>=Left_2 then
					LeftNews=Left(strng,Left_0)
				Else
					LeftNews=Left(strng,Left_1+NewsLength)&Points&"</font></a>"
				End if
			Else
				Left_1=Instr(strng,"_blank>")+7
				Left_2=Instr(strng,"</a>")
				If Left_1+NewsLength>=Left_2 then
					LeftNews=Left(strng,Left_0)
				Else
					LeftNews=Left(strng,Left_1+NewsLength)&Points&"</a>"
				End if
			End if
		Else
			LeftNews=strng
		End if
	End Function
	
	Function NewString(wstr,strng)
		NewString=Instr(wstr,strng)
	End Function
	
	Function NumDate()
		NumDate=Year(Date())&AddZero(Month(Date()),2)&AddZero(Day(Date()),2)
	End Function
	
	Function FormatDate(theDate,n)
		FormatDate=Year(theDate)&n&AddZero(Month(theDate),2)&n&AddZero(Day(theDate),2)
	End Function
	
	Function AddZero(m,n)		'添加0
		If Len(m)<n then
		AddZero=string(n-Len(m),"0")&m
		Else
		AddZero=m
		End if
	End function
		
	Function LL(strng)
	LL=Left(strng,Instr(strng,"</a>")+3)
	End function
	
	Erase ArrayNewsImg
	Erase ArrayNewsTitle
%>

⌨️ 快捷键说明

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