重庆洋展购有卖dha吗:在ASP中,滚动的链接(比如多条新闻)的代码怎么写?

来源:百度文库 编辑:高校问答 时间:2024/04/26 17:32:13
在ASP中,滚动的链接(比如多条新闻)的代码怎么写?

分两个页面写,下面是个例子。
test1.asp
<script lanuage="javascript">
function turnit(a,b,n)
{
{Content1.style.display="none";
Content2.style.display="none";
Content3.style.display="none";
Content4.style.display="none";
Content5.style.display="none";
Content6.style.display="none";
Content7.style.display="none";
Content8.style.display="none";
Content9.style.display="none";
Content10.style.display="none";

Img1.src="";
Img2.src="";
Img3.src="";
Img4.src="";
Img5.src="";
Img6.src="";
Img7.src="";
Img8.src="";
Img9.src="";
Img10.src="";
}
{a.style.display="";
b.src="images/bullet1.gif";
}
}
function opwin(id){
window.open ('notice_3.asp?id='+id, 'newwindow', 'height=400, width=350, top=20, left=20, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}

</script>
<table width="180" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="5" height="5"></td>
<td height="5"></td>
<td width="5" height="5"></td>
</tr>
<tr>
<td></td>
<td height="20" align="center"> </td>
<td></td>
</tr>
<tr>
<td width="5"></td>
<td height="20"><div align="center">
<marquee direction=up height=160 id=gundong onMouseOut=gundong.start() onMouseOver=gundong.stop() scrollamount=1 scrolldelay=80 width=160>
<font style="COLOR: black; FONT-SIZE: 9pt">
<!-- #include file="notice.asp" -->
</font>
</marquee>
</div>
<div align="center">
<a href="###" onMouseOver='gundong.direction="down"'>
<font color=#ff0000 size=1>∧</font></a>
<span lang=en-us>---</span>
<a href="###" onMouseOver='gundong.direction="up"'>
<font color=#ff0000 size=1>∨</font></a>
</div></td>
<td width="5"></td>
</tr>
<tr>
<td width="5" height="5"></td>
<td height="5"></td>
<td width="5" height="5"></td>
</tr>
</table>

下面是notice.asp的内容:
<!-- #include file="conn.asp" -->
<%
set Rs=server.createobject("adodb.recordset")
sql="select top 5 * from 公告列表 ORDER BY 发布日期 DESC"
Rs.open sql,conn,1,3
if not rs.eof then
ntjs=0
while not rs.eof
response.Write("<font color='#ff0000'>※ </font><span style='color: black; text-decoration: none; font-size: 9pt'><font color='#AB2323'><a href='###' onclick='javascript:opwin(" &rs("id") &");'>" & rs("公告标题") &"</a></font><br><font color='#999999'>(发布日期:" & rs("发布日期") &")</font></span>")
response.Write("<br>--------------------------<br>")
end if
rs.movenext
wend
if ntjs=0 then response.Write("<br>今天没有公告,欢迎您光临!<br>")
else
response.Write("<br>今天没有公告,欢迎您光临!<br>")
end if
rs.close
set rs=nothing
%>

说明下。以上代码复制过去根本运行不成功,因为涉及到数据库的读写了。另例子给的只是滚动标题了,具体的新闻内容没有输出,可以根据您的需要自行更改。