asp如何实现图片的动态翻动的效果
yoken
阅读:1431
2007-10-15 08:08:00
评论:0
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 3 * from table order by id desc",conn,1,1
ii=1
do while not rs.eof%>
<td><img src=''<%=rs("img")%>'' id=''img<%=ii%>''><br><div id=''txt<%=ii%>''><%=rs("title")%></div></td>
<%ii=ii+1
rs.movenext
loop
rs.close
set rs=nothing
%>
<td><input type=button value=''>'' name=rights onclick="rightimg();"></td>
</tr>
<script>
var imgarray=new Array();
var txtarray=new Array();
var ipos=0;
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 5 * from table order by id desc",conn,1,1
ii=0
do while not rs.eof%>
imgarray[<%=ii%>]="<%=rs("img")%>";
txtarray[<%=ii%>]="<%=rs("title")%>";
<%
ii=ii+1
rs.movenext
loop
rs.close
set rs=nothing%>
function leftimg(){
ipos++;
ipos2=ipos;
if(ipos2>4){ipos2=0;ipos=0}
img1.src=imgarray[ipos2];
txt1.innerHTML=txtarray[ipos2];
ipos2++;
if(ipos2>4){ipos2=0}
img2.src=imgarray[ipos2]
txt2.innerHTML=txtarray[ipos2];
ipos2++;
if(ipos2>4){ipos2=0}
img3.src=imgarray[ipos2]
txt3.innerHTML=txtarray[ipos2];
}
function rightimg(){
ipos--;
ipos2=ipos;
if(ipos2<0){ipos2=4;ipos=4}
img1.src=imgarray[ipos2]
txt1.innerHTML=txtarray[ipos2];
ipos2++;
if(ipos2>4){ipos2=0}
img2.src=imgarray[ipos2]
txt2.innerHTML=txtarray[ipos2];
ipos2++;
if(ipos2>4){ipos2=0}
img3.src=imgarray[ipos2]
txt3.innerHTML=txtarray[ipos2];
}
</script>
转载保留链接!网址:https://80920140.com/post/89.html
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源; 2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任; 3.作者投稿可能会经我们编辑修改或补充。
发表评论