手机版

基于jQuery实现图片的前进与后退功能

时间:2021-11-21 来源:互联网 编辑:宝哥软件园 浏览:

复制代码代码如下:DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN ' ' http://www .w3。L1-过渡时期。DTD ' html xmlns=' http://www .w3。org/1999/XHTML ' head title/title style=' text/CSS ' # mydiv { position : absolute;宽度宽度:500像素高度:400 px前:50%;左侧:50%;边距-top :-200 px;边距-左侧:-290像素;} img { width:480px高度:380 px}/style脚本src=' http : jquery-1。9 .1 .js ' type=' text/JavaScript '/script script src=' http : jquery 1。7 .js ' type=' text/JavaScript '/script script type=' text/JavaScript ' $(function(){ var array=[1,2,3,4,5,6];定义变量计数=0;//后退$('#Button1 ').单击(function(){ if(count 0){ count-;$('img ').attr('src ',' images/'数组[数]数.jpg’);} }) //前进$('#Button2 ').单击(function(){ if(count 5){ count;$('img ').attr('src ',' images/'数组[数]数.jpg’);} })})))/脚本/标题/正文div id=' mydiv ' tabletdinput id=' button 1 ' type=' button ' value=' '//TDT img src=' http : images/1。jpg '/TDT输入id=' button 2 ' type=' button ' value=' '//TD/tr/table/div/body/html效果如下

版权声明:基于jQuery实现图片的前进与后退功能是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。