首页精彩推荐图片实现无缝滚动的方法
作者:cmscn 日期:2005-04-11
在index2.asp中插入下面这段代码:
sub main_center_pic(cs_tnum,cs_cnum)
dim tmp1,tmp_topic,tmp_url
tmp1=vbcrlf&"<tr align=center>"
sql="select top "&cs_tnum&" id,name,spic from gallery where hidden=1 and types='paste' order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
tmp_topic=rs(1)
tmp_url="gallery_view.asp?id="&rs(0)
tmp1=tmp1&vbcrlf&"<td>" & _
vbcrlf&" <table border=0 cellspacing=0 cellpadding=0>" & _
vbcrlf&" <tr><td align=center>"&pic_fk(rs("spic"),1,tmp_url)&"</td></tr>" & _
vbcrlf&" <tr><td align=center height="&dim_num(6)&"><a href='"&tmp_url&"' target=_blank>"&joekoe_cms.code_html(tmp_topic,1,cs_cnum)&"</a></td></tr>" & _
vbcrlf&" </table>" & _
vbcrlf&"</td>"
rs.movenext
loop
rs.close
tmp1=tmp1&vbcrlf&"</tr>"
tmp1="<table border=0 cellspacing=0 cellpadding=2 width='100%'>"&tmp1&vbcrlf&"</table>"
response.write vbcrlf&"<table cellspacing=1 cellpadding=4 class=table>" & _
vbcrlf&"<tr><td class=td0> <a href='gallery.asp?types=paste'><font color=white> 推荐贴图</font></a></td></tr>" & _
vbcrlf&"<tr class=bg_td><td align=center><div id=demo style=overflow:hidden;height:120;width:550>"& _
vbcrlf&"<table align=left cellpadding=0 cellspace=0 border=0><tr>"& _
vbcrlf&"<td id=demo1 valign=top>"&tmp1&" </td>"& _
vbcrlf&"<td id=demo2 valign=top></td></tr></table>"& _
vbcrlf&"</div>"& _
vbcrlf&"</td></tr>" & _
vbcrlf&"<script>"& _
vbcrlf&"var speed=30" & _
vbcrlf&"demo2.innerHTML=demo1.innerHTML" & _
vbcrlf&"function Marquee(){" & _
vbcrlf&"if(demo2.offsetWidth-demo.scrollLeft<=0)" & _
vbcrlf&"demo.scrollLeft-=demo1.offsetWidth" & _
vbcrlf&"else{" & _
vbcrlf&"demo.scrollLeft++" & _
vbcrlf&"}" & _
vbcrlf&"}" & _
vbcrlf&"var MyMar=setInterval(Marquee,speed)" & _
vbcrlf&"demo.onmouseover=function() {clearInterval(MyMar)}" & _
vbcrlf&"demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}" & _
vbcrlf&" </script> "& _
vbcrlf&"</table>"&ukong
end sub
调用:call main_center_pic(8,12)
说明:如果调用flash,将"paste"改为"flash"即可。
评论: 7 | 引用: 0 | 查看次数: 791
发表评论