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=utf-8" /> <title>图片切换</title> </head> <body><script language="JavaScript1.1"> <!-- var slidespeed=2000 var slideimages=new Array("https://www.jb51.net/images/1.jpg","images/2.jpg","images/3.jpg","images/4.jpg") var imageholder=new Array() var ie55=window.createPopup for (i=0;i<slideimages.length;i++){ imageholder[i]=new Image() imageholder[i].src=slideimages[i] } function gotoshow(){ window.location=slidelinks[whichlink] } //--> </script> <img src="https://www.jb51.net/images/1.jpg" border=0> <script language="JavaScript1.1"> <!-- var whichlink=0 var whichimage=0 var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0 function slideit(){ if (!document.images) return if (ie55) document.images.slide.filters[0].apply() document.images.slide.src=imageholder[whichimage].src if (ie55) document.images.slide.filters[0].play() whichlink=whichimage whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0 setTimeout("slideit()",slidespeed+pixeldelay) } slideit() //--> </script> </body> </html>

更多关于JavaScript相关内容感兴趣的读者可查看本站专题:《JavaScript图片操作技巧大全》、《JavaScript运动效果与技巧汇总》、《JavaScript切换特效与技巧总结》、《JavaScript错误与调试技巧总结》、《JavaScript数据结构与算法技巧总结》、《JavaScript遍历算法与技巧总结》及《JavaScript数学运算用法总结

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwgzys.html