武汉网福

  博客园  ::  :: 新随笔  :: 联系 ::  :: 管理
<div id="demow" style="width:500px;float:left;overflow:hidden;white-space:nowrap;"><div id="demow1">
     <%set rs=server.CreateObject("adodb.recordset")
        sql="select top 3 title,articleid from news where smallclassname='滚动公告' order by articleid desc"
        rs.open sql,conn,1,3
        do while not rs.eof
        %><a href="news_show.asp?articleid=<%=rs("articleid")%>" target="_blank"><font color="#990000"><%=rs("title")%></font></a>&nbsp;&nbsp;&nbsp;&nbsp;<%
   rs.movenext
   loop
   rs.close
   set rs=nothing
   %></div><div id="demow2"></div>
</div>
<script style="text/javascript">
var speed=40;//数值越大,速度越慢
var demow2=document.getElementById("demow2");
var demow1=document.getElementById("demow1");
var demow=document.getElementById("demow");
function MarqueeLeft(){
if(demow2.offsetWidth-demow.scrollLeft<=0)
demow.scrollLeft-=demow1.offsetWidth
else{
demow.scrollLeft++
}
}
var MyMar=setInterval(MarqueeLeft,speed);
demow.onmouseover=function() {clearInterval(MyMar);}
demow.onmouseout=function() {MyMar=setInterval(MarqueeLeft,speed);}
</script>
posted on 2012-10-17 16:02  武汉网福互联  阅读(796)  评论(0编辑  收藏  举报