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)
<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)
相关文章推荐
- 【JSOI2016】最佳团队
- 首页JS新闻代码
- 和JS斗争到底!笔记本看货验机全攻…
- 上下滚动的文字——JS代码
- 圆形点数组,螺旋点数组生成函数
- JavaScript中逻辑运算符(&&、||、!)的优先级和运算顺序
- JS脚本实现动态给标签控件添加事件的方法
- JSON学习笔记
- JavaScript来实现打开链接页面的简单实例
- [Json] 1 - 数据格式(转)
- JavaScript实现打开链接页面的方式汇总
- JS读取XML文件数据并以table形式显示数据的方法(兼容IE与火狐)
- JavaScript序列化对象成URL格式
- JavaScript-正则表达式
- 七牛上传文件(JS实现)
- JS 判断浏览器是否安装Flash 兼容IE、firefox
- 关于js的一些基本知识(类,闭包,变量)
- Extjs5.1 MVC模式下,数据提交问题:Model.save()
- 客户端javascript笔记
- JsperReport导出PDF报表中文不显示