<head>
    <title>images 集合显示一个幻灯片</title>
    <script type="text/javascript">
    
        var currentPhoto=0;
        var pics=new Array();
        
        for(var i=0;i<5;i++){
            pics[i]=new Image();
        }
        
        pics[0].src="../images/flower.bmp";
        pics[1].src="../images/girls.jpg";
        pics[2].src="../images/likes.jpg";
        pics[3].src="../images/moon.jpg";
        pics[4].src="../images/vehicle.jpg";
                
        function changePhoto(photo){
            document.images[0].src=pics[photo].src;
        }
        
        function nextPic(){
            currentPhoto++;
            if((currentPhoto<pics.length){
                changePhoto(currentPhoto);
            }else{
                alert("At the end of the photo list");
            }
        }
        
        function prevPic(){
            if(pics.length>0){
                currentPhoto--;
                changePhoto(currentPhoto);
            }else{
                alert("At the beginning of the photo list");
            }
        }
    </script>
    
</head>
<body>    <img src="../images/girls.jpg" />
    <p>
    <a href="" onclick="nextPic();return false">Next picture</a><br />
    <a href="" onclick="prevPic();return false">Previous picture</a>
    </p>
</body>
点击 Next picture 或 Previous picture 时,显示不出下一张图片(新手上路),请大虾们指教 !