请教如何在jscript中引用分页显示的asp程序?

lhls 2003-12-15 11:00:31
我有一个能分页显示的新闻系统,我也会用jscript作简单的新闻滚动发布,那么请教如何在jscript中引用分页显示的asp程序?附:
1.jscript 程序:
document.write("<marquee behavior=scroll hspace=5 vspace=1 direction=up width=200 height=90 scrollamount=1 scrolldelay=10 onmouseover='this.stop()' onmouseout='this.start()'>");
document.write("<a href=gonggao/zhuanli.htm target=_blank> <font size=2 class=red>^</font> 专利转让,欲购从速</a><br> <a href=sbyw/sqs.htm target=_blank> <font size=2 class=red>^</font> 国家商标局新版商标申请书式</a><br></font>");
document.write("</marquee>");

2.分页显示程序:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>xxkd</title>
<link rel="stylesheet" type="text/css" href="/css/news.css">

<Script language="JavaScript">
//打开新窗口函数NewsWindow
function NewsWindow(id)
{
window.open('newswind.asp?id='+id,'infoWin', 'height=400,width=600,scrollbars=yes,resizable=yes');
}
</Script>
</head>

<body>
<%
set conn=server.createobject("ADODB.CONNECTION")
conn.open "DBQ="+server.mappath("news.mdb")+";DRIVER={Microsoft Access Driver (*.mdb)};"
set rs=server.createobject("adodb.recordset")
sql="SELECT * from news order by times desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p>还 没 有 任 何 新 闻</p>"
else%>
<p><strong><font color="#993333">商标新闻</font> </strong><br>
<table border=1 borderColorDark=#ffffec borderColorLight=#5e5e00 cellPadding=1 cellSpacing=0 width=100%>
<tr bgcolor=cccccc align=center><td>标题</td><td>出处</td><td>日期</td></tr>
<%
cc=1
'当前页
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.PageSize=25
rs.AbsolutePage=pagecount
For iPage = 1 To rs.PageSize
If rs.EOF Then Exit For
'不同行之间以不同颜色显示
if cc mod 2=1 then
Response.Write "<tr bgcolor=#E7E7E7>"
else
Response.Write "<tr BGCOLOR=#F4F4F4>"
end if
%>
<td><a href="javascript:NewsWindow(<%=rs("ID")%>)"><u><%=rs("title")%></u></a></td><td><%=rs("write")%></td><td><%=rs("times")%>
<%
'如果是今天的新闻,加上new标记
if DateDiff("d",rs("times"),date())<1 then Response.Write "<font color=ff0000>new</font>"
Response.Write "</td></tr>"
cc=cc+1
rs.movenext
Next
Response.Write "</table><p>共"&rs.recordcount&"篇新闻"
if rs.PageCount>1 Then
If pagecount<>1 Then
Response.Write "<A HREF=xxkd.asp?Page=1> 首页</A>"
Response.Write "<A HREF=xxkd.asp?Page="&(pagecount-1)&"> 前页<<</A>"
End If
If pagecount<>rs.PageCount Then
Response.Write "<A HREF=xxkd.asp?Page="&(pagecount+1)&"> 后页>></A>"
Response.Write "<A HREF=xxkd.asp?Page="&rs.PageCount&"> 尾页</A>"
End If
End If
Response.Write "<A HREF=/index.asp> 返回主页</A>"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<p align=center> 


...全文
49 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
bzscs 2003-12-15
  • 打赏
  • 举报
回复
用fso生成js文件
lhls 2003-12-15
  • 打赏
  • 举报
回复
我的目的是只要在后台添加新闻后,在首页自动滚动显示添加的新新闻。有没有类似的代码或文章?
lhls 2003-12-15
  • 打赏
  • 举报
回复
“用fso生成js文件”请详细道来,谢了
xiaogug 2003-12-15
  • 打赏
  • 举报
回复
同意楼上的!

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧