js实现图片上下滚动切换显示,用户也可以通过点击上下箭头按钮来滚动图片展示,结合自己的需求来修改即可。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>带上下箭头按钮图片切换广告代码_武鸣人</title> <style> *{margin:0;padding:0;border:0;list-style:none;} body{font:12px Verdana, Geneva, sans-serif;line-height:18px;color:#333;} a{text-decoration:none;color:#004285;font-size:14px;font-weight:bold;} a:hover{text-decoration:underline;color:#C33;} .www_wuming_ren{border:1px solid #dedede;width:282px;margin-bottom:5px;position:relative;background:#fff;} #qy a{font-size:12px;} h5 span a{font-size:12px;font-weight:normal;color:#333;} h5{padding:0 10px;font-size:14px;height:30px;line-height:30px;background:url() left center repeat-x;border-bottom:1px solid #dedede;} span{float:right;} </style> <style> #btm_wuming{position:absolute;right:0;top:60px;width:12px;height:43px;background:url(/img/20240510_www_wuming_ren_2.gif) no-repeat;overflow:hidden;} #btm_wuming a{display:block;height:22px;} #btm_wuming a#wuming_up:hover{background:url(/img/20240510_www_wuming_ren_2.gif) -13px top no-repeat;} #btm_wuming a#wuming_dw:hover{background:url(/img/20240510_www_wuming_ren_2.gif) -26px -22px no-repeat;} </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div class="www_wuming_ren"> <h5><span><a href="https://wuming.ren">更多>></a></span>武鸣人专题</h5> <div id="qy" style="width:256px;margin:7px 10px 5px;height:94px;overflow:hidden" onMouseOver="qiScrollAmount=0" onmouseout="qiScrollAmount=2"> <ul> <li id="tab1"> <table border='0' cellspacing='0' cellpadding='0' width='256px'> <tr> <td height='70'><a href="https://www.wuming.ren"><img src="/img/20240510_www_wuming_ren_3.jpg" /></a></td> </tr> <tr> <td height='24'><span><a href="https://www.wuming.ren">进入专题</a></span> <p><a href="https://www.wuming.ren">武鸣人一号信息</a></p></td> </tr> <!--一行--> <tr> <td height='70'><a href="https://www.wuming.ren"><img src="/img/20240510_www_wuming_ren_4.jpg" /></a></td> </tr> <tr> <td height='24'><span><a href="https://www.wuming.ren?p=33">进入专题</a></span> <p><a href="https://www.wuming.ren">武鸣人二号信息</a></p></td> </tr> <!--一行--> <tr> <td height='70'><a href="https://www.wuming.ren"><img src="/img/20240510_www_wuming_ren_4.jpg" /></a></td> </tr> <tr> <td height='24'><span><a href="https://www.wuming.ren?p=888.html">进入专题</a></span> <p><a href="https://www.wuming.ren">武鸣人三号信息</a></p></td> </tr> </table> </li> <li id="tab2"></li> </ul> </div> <div id="btm_wuming"><a id="wuming_up" onclick="wuming_up()" href="javascript:;" target="_self"></a><a id="wuming_dw" onclick="wuming_dw()" href="javascript:;" target="_self"></a></div> <script> var qoMarquee = document.getElementById("qy"); //滚动对象 var tab1 = document.getElementById("tab1"); var tab2 = document.getElementById("tab2"); var qiLineHeight = 94;//单行高度,像素IE var qiLineCount = 0; //实际行数 var qiScrollAmount = 2; //每次滚动高度,像素(速度) var speed1=3000;//每次停留时间 var speed2=1;//滚动速度 var num=qoMarquee.getElementsByTagName('img').length;//总数 tab2.innerHTML=tab1.innerHTML; var alink=document.getElementById('btm_wuming').getElementsByTagName('a'); for(var i=0;i<alink.length;i++){ alink[i].onfocus=function(){this.blur();} } function run() { if(qoMarquee.scrollTop==num*qiLineHeight){qoMarquee.scrollTop=0;window.setTimeout( "run()", speed2 );}//重置并接着滚动 else{ qoMarquee.scrollTop +=qiScrollAmount; if ( qoMarquee.scrollTop % qiLineHeight == 0 ) {window.setTimeout( "run()", speed1 );}//如果满格等待N秒 else {window.setTimeout( "run()", speed2 );}//正常滚动 } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function wuming_up(){ qiScrollAmount = 0; var amount=1; if(qoMarquee.scrollTop==num*qiLineHeight) qoMarquee.scrollTop=0; qoMarquee.scrollTop +=amount; if ( qoMarquee.scrollTop % qiLineHeight == 0 ) {amount=0;window.setTimeout( "qiScrollAmount = 2", speed1 );} else window.setTimeout( "wuming_up()", 1 ); } function wuming_dw(){ qiScrollAmount = 0; var amount=1; if(qoMarquee.scrollTop==0) qoMarquee.scrollTop=num*qiLineHeight; qoMarquee.scrollTop -=amount; if ( qoMarquee.scrollTop % qiLineHeight == 0 ) {amount=0;window.setTimeout( "qiScrollAmount = 2", speed1 );} else window.setTimeout( "wuming_dw()", 1 ); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) window.setTimeout( "run()", speed1 ); </script> </div> </body> </html>
本文来自武鸣人网站,转载请注明出处