ASP如何与javascript结合,实现图片循环滚动功能

zj314563 zj314563 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<%
set rs=server.create("adodb.recordset")
sql="SELECT top 5 PhotoID,PhotoUrl FROM Photo,PhotoClass where Photo.ClassID=PhotoClass.ClassID and PhotoClass.ClassName='荣誉嘉奖' order by PhotoID Desc"
rs.open sql,conn,1,1
if not rs.eof then%>
<script type="text/javascript">
document.write('<table align=center width=774 border=0 cellpadding=0 cellspacing=0 style=BORDER-LEFT: #cccccc 1px solid;BORDER-RIGHT: #cccccc 1px solid>');
document.write(' <tr> ');
document.write(' <td width=774 height=120 align=center class=border01 bgcolor=#FFFFFF>');
document.write(' <div id=demo style=overflow:hidden;width:750;align=center>');
document.write(' <table border=0 align=center cellpadding=1 cellspacing=1 cellspace=0 >');
document.write(' <tr>');
document.write(' <td valign=top bgcolor=ffffff id=marquePic1> ');
document.write(' <table width=90% border=0 cellspacing=0 cellpadding=0>');
document.write(' <tr align=center> ');
document.write(' <td><a href="showview.asp?PhotoID=<%=rs("PhotoID")%>" target="new"><img src='<%rs("PhotoUrl")%>' width=150 height=100 hspace=2 border=0></a></td>');
document.write(' </tr>');
document.write(' </table>');
document.write(' </td>');
document.write(' <td id=marquePic2 valign=top></td>');
document.write(' </tr>');
document.write(' </table>');
document.write(' </div>');
document.write(' </td>');
document.write(' </tr>');
document.write(' </table>');
var speed=30
marquePic2.innerHTML=marquePic1.innerHTML
function Marquee(){
if(demo.scrollLeft>=marquePic1.scrollWidth){
demo.scrollLeft=0
}else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>

<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
这个代码有问题,请问应该怎么写,试了好几次都不行
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
zj314563
ASP 28,401 成员 356,940 内容