有很多网友再问如何做一个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
TSYS 新闻列表JS调用下载
内容版权声明:除非注明,否则皆为本站原创文章。