您的位置:首页 > Web前端 > JavaScript

JS调用新闻

2016-06-02 12:51 651 查看
调用代码:

<script language="javascript"
src="hot_news.asp?SmallClassID=2&n=5"></script>

注释:
n为显示的条数

 

hot_news.asp页面的代码:

javastr=""

javastr=javastr+"<table width=\"100%\" border=\"0\"
cellpadding=\"0\" cellspacing=\"0\">"

<!--#include file="include/buyok_shop_30_conn.asp"-->

<%

SmallClassID=Trim(Request("SmallClassID"))

n=request("n")

if n="" then

n=20

end if%>

<%

'if owen1<>"" and owen2<>"" then

sql="select  * from NEWS where SmallClassID="&
SmallClassID &" order by NewsID desc"

set rs=conn.execute(sql)

do while not rs.eof

%>

javastr=javastr+"<tr><td height=\"24\"
style=\"BORDER-bottom: #999999 1px dotted\">"

javastr=javastr+"◎ <span
style=\"font-size:9pt;line-height:15pt\"><a
href=\"onews.asp?id=<%=rs("NewsID")%>\"
title=\"<%=rs("NewsTitle")%>\"
target=\"_blank\"><%=left(rs("NewsTitle"),12)%></a></span>
"

javastr=javastr+"</td></tr>"

<%n=n-1

if n<1 then exit do

rs.movenext

loop

%>

javastr=javastr+"</table>"

<%

rs.close  

set rs=nothing  

%>

document.write (javastr)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: