有很多網友再問如何做一個JS新聞調用程序,現在貼出來供大家參考:
JS調用程序:
List2.asp
源碼:--------------------------------------------------------------------------------
<!--#include file="Conn.asp" -->
<%
Dim RS,Sql
Dim SpecId '資源特性Id
SpecId=CLng(Request("SpecId"))
Sql="select Top 10 Id,Title,FilePath From view_NewsInfo where Instr(','+Speciality+',',',"&SpecId&",')<>0 Order By Id DESC"
Set Rs=Conn.ExeCute(Sql)
While Not Rs.Eof
Response.Write "document.write(""<a href='/Tsys/NewsFiles/"&Rs("FilePath")&"' target='_blank'>"&Rs("Title")&"</a><br/>"")" & vbCrLf
Rs.MoveNext
Wend
Rs.Close
Set Rs=Nothing
%>
--------------------------------------------------------------------------------
調用方法:
源碼:------------------------------------------------------------------------
<script src="list2.asp?specId=13"></script>
--------------------------------------------------------------------------------
說明一下..............上面是TSYS1.0的....
下面是我寫的TSYS1.1加強版的..
<!--#include file="Include/Config.asp" -->
<%
Dim RS,Sql
Dim SpecId '資源特性Id
SpecId=CLng(Request("SpecId"))
Dim Conn
Set Conn = Server.createObject("Adodb.Connection")
Conn.Open ConnStr
Sql="select Top 10 Id,Title,FilePath From view_NewsInfo where Instr(','+Speciality+',',',"&SpecId&",')<>0 Order By Id DESC"
Set Rs=Conn.ExeCute(Sql)
While Not Rs.Eof
Response.Write "document.write(""<a href='"&Rs("FilePath")&"' target='_blank'>"&Rs("Title")&"</a><br/>"")" & vbCrLf
Rs.MoveNext
Wend
Rs.Close
Set Rs=Nothing
conn.close
set conn=nothing
%>
大家看Include/Config.asp應該知道保存在什麼地方了吧...
大家可以看下演示:
http://31u.net/html/zhuanti/daima005.htm
調用的是www.31u.net首頁的推薦信息...特性為35..
當然可以根據這個來寫出分欄目的JS新聞列表... from 31u.com