滚动图片新闻
作者:cmscn 日期:2005-04-11
1。首先把gdxw.js放到style中
2。在skin.asp中最后一个%>加下面代码
sub gdxw()
dim id,topic,pic
sql="select top 10 id,topic,pic from news where hidden=1 and ispic=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
response.write " <div id=rolllink style=overflow:hidden;height:160;width:180>"
response.write " <div id=rolllink1>"
response.write " <table cellspacing=0 cellpadding=0 border=0 width='100%'>"
do while not rs.eof
id=rs("id")
topic=rs("topic")
response.write vbcrlf&" <tr align=center><td><a href='news_view.asp?id="&id&"' target=_blank alt='"&joekoe_cms.code_html(topic,1,0)&"'>"&pic_fk(rs("pic"),2,"news_view.asp?id="&id)&"</a></td></tr>"
response.write vbcrlf&" <tr align=center><td><a href='news_view.asp?id="&id&"' target=_blank alt='"&joekoe_cms.code_html(topic,1,0)&"'>"&joekoe_cms.code_html(topic,1,14)&"</a></td></tr>"
rs.movenext
loop
response.write vbcrlf&" </table>"
response.write vbcrlf&" </div><div id=rolllink2></div></div>"
%>
<script language=javascript src='style/gdxw.js'></script>
<%
response.write vbcrlf&"</td>"
end sub
3。首页调用call gdxw()
<% '----------------------------滚动图片新闻 开始----------------------------
sub gdxw()
sql="select top 10 id,topic,pic from news where hidden=1 and ispic=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
response.write " <div id=rolllink style=overflow:hidden;height:120;width:160>"
response.write " <div id=rolllink1>"
response.write " <table cellspacing=0 cellpadding=0 border=0 width='100%'>"
do while not rs.eof
id=rs("id")
topic=rs("topic")
response.write vbcrlf&" <tr align=center><td><a href='news_view.asp?id="&id&"' target=_blank alt='"&joekoe_cms.code_html(topic,1,0)&"'><script language=javascript>document.write(pic_fk('"&rs("pic")&"',2,'news_view.asp?id="&id&"'));</script></a></td></tr>"
response.write vbcrlf&" <tr align=center><td><a href='news_view.asp?id="&id&"' target=_blank alt='"&joekoe_cms.code_html(topic,1,0)&"'>"&joekoe_cms.code_html(topic,1,16)&"</a></td></tr>"
rs.movenext
loop
response.write vbcrlf&" </table>"
response.write vbcrlf&" </div><div id=rolllink2></div></div>"
%>
<script language=javascript src='../style/gdxw.js'></script>
<%
response.write vbcrlf&"</td>"
end sub
'----------------------------滚动图片新闻结束---------------------------- %>
gdxw.js内容如下:
var rollspeed=30
rolllink2.innerHTML=rolllink1.innerHTML
function Marquee(){
if(rolllink2.offsetTop-rolllink.scrollTop<=0)
rolllink.scrollTop-=rolllink1.offsetHeight
else{
rolllink.scrollTop++
}
}
var MyMar=setInterval(Marquee,rollspeed)
rolllink.onmouseover=function() {clearInterval(MyMar)}
rolllink.onmouseout=function() {MyMar=setInterval(Marquee,rollspeed)}
评论: 5 | 引用: 0 | 查看次数: 824
发表评论