首页 > 编程语言 > 详细

JavaScript 学习中

时间:2016-01-06 00:12:27      阅读:230      评论:0      收藏:0      [点我收藏+]

实现轮翻    低级技术可以参考:

代码

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>建立循环式的灯幻片</title>
        <script type="text/javascript">
            window.onload=iniAll;
            var mypix=new Array("img/1.jpg","img/2.jpg","img/3.jpg");
            var thispic=0;
            function iniAll(){
                document.getElementById("pre").onclick=preprocess;
                document.getElementById("next").onclick=nextprocess;
            }
            function preprocess(){
                if(thispic==0){
                    thispic=mypix.length;
                }
                thispic --;
                document.getElementById("mypicture").src=mypix[thispic];
                
            }
            function nextprocess(){
                    thispic ++;
                if(thispic==mypix.length){
                    thispic = 0 ;
                }
                document.getElementById("mypicture").src=mypix[thispic]
                return false;
            }
        </script>
        <style type="text/css">
            img
        </style>
    </head>
    <body>
        <div id="centered">
             <h1>imge slidershow</h1>
             <img src="img/1.jpg" id="mypicture" alt="sideshow"/>
             <h1>
                 <a href="#" id="pre">&lt;&lt; pre</a>&nbsp;&nbsp;
                 <a href="#" id="next">next&gt;&gt;</a>
             </h1>
        </div>
    </body>
</html>

JavaScript 学习中

原文:http://www.cnblogs.com/webph/p/5103951.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!