2012-08-30 101 views
0

我正在使用以下代碼並嘗試了許多其他代碼以在幻燈片中顯示圖像。但一切都是徒勞..沒有錯誤是在我的代碼,但不是一個單一的圖像顯示的是網頁上的..我的代碼是:使用javascript的幻燈片放映中不顯示圖像

<html> 
<head> 
<style> 

body{ 

    background-color: black; 
    padding:0; 
    margin:0; 
    width:320px; 
    height:480px; 

} 
img{ 
    -webkit-transition-property:opacity; 
    -webkit-transition-duration:3s; 
    position:absolute; 
    width:320px; 
    height:auto; 

} 
img.fade-out{opacity:0;} 
img.fade-in{opacity:1;} 

</style> 
</head> 
<body> 

<img src = "Slide1.JPEG";/> 
<img src = "Slide2.JPEG";/> 
<img src = "Slide3.JPEG";/> 
<img src = "Slide4.JPEG";/> 


var interval = 4 * 20; 

var images = document.getElementsByTagName("img"); 
var imageArray = []; 
var imageCount = images.length; 
var current =0; 

var randomize = funtion() { 

    return (Math.round(Math.random() * 3 - 1.5)); 
} 

for(var i=0; i<imageCount; i++) { 

    images[i].className = 'fade-out'; 

    imageArray[i] = images[i]; 
} 

imageArray.sort(randomize); 

var fade = function() { 

    imageArray[current++].className = 'fade-out'; 

    if(current == imageCount) { 

     current = 0; 

     imageArray.sort(randomize); 

    } 

imageArray[current].className = 'fade-in'; 

setTimeout(fade,interval * 100); 

}; 
fade(); 
</script> 
} 

</body> 
</html> 

請指引我哪裏是錯誤。 感謝

+0

你缺少''