2013-10-13 58 views
0

正如標題所示,幻燈片顯示在本地工作,但不在上傳到服務器時顯示。Javascript幻燈片無效;在本地工作但不在上傳時

該網站是http://cmp.physics.iastate.edu/esl/photos.html

幻燈片代碼:

<script type="text/javascript"> 
<!--> 
    var image1=new Image() 
    image1.src="images/ESL Keep/Thumbnails/IMG_2509.jpg" 
    var image2=new Image() 
    image2.src="images/ESL Keep/Thumbnails/IMG_2510.jpg" 
    var image3=new Image() 
    image3.src="images/ESL Keep/Thumbnails/IMG_2518.jpg" 
    var image4=new Image() 
    image4.src="images/ESL Keep/Thumbnails/IMG_2536.jpg" 
    var image5=new Image() 
    image5.src="images/ESL Keep/Thumbnails/IMG_2537.jpg" 
    var image6=new Image() 
    image6.src="images/ESL Keep/Thumbnails/IMG_2537.jpg" 
    var image7=new Image() 
    image7.src="images/ESL Keep/Thumbnails/IMG_2543.jpg" 
//--> 
</script> 
<img src="images/ESL Keep/Thumbnails/IMG_2509.jpg" name="slide" width="450" height="300"/> 
<script type="text/javascript"> 
<!-- 
    var step=1 
    function slideit(){ 
     document.images.slide.src=eval("image"+step+".src") 
     if(step<6) 
      step++ 
     else 
      step=1 
     setTimeout("slideit()",3000) 
    } 
    slideit(); 
//--> 
</script> 

任何人都有,爲什麼它不工作的任何想法或理由?

任何幫助表示讚賞。謝謝。

+3

打開您的控制檯,你就會明白爲什麼。 – lifetimes

+0

對不起,因爲我的無知,但我是相當新的這一點,不知道什麼「控制檯」意味着當談到這一點。 – user2876702

+0

你確定你的圖片是在正確的地方嗎? 「images/ESL Keep/Thumbnails /」 –

回答

0

你的照片缺失查看網站錯誤:

Failed to load resource: the server responded with a status of 404 (Not Found) http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2509.jpg 
Failed to load resource: the server responded with a status of 404 (Not Found) http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2510.jpg 
Failed to load resource: the server responded with a status of 404 (Not Found) http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2518.jpg 
Failed to load resource: the server responded with a status of 404 (Not Found) http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2536.jpg 
Failed to load resource: the server responded with a status of 404 (Not Found) http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2537.jpg 
Failed to load resource: the server responded with a status of 404 (Not Found) http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2543.jpg 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2510.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2518.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2536.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2537.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2537.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2509.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2510.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2518.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2536.jpg 404 (Not Found) photos.html:78 
GET http://cmp.physics.iastate.edu/esl/images/ESL%20Keep/Thumbnails/IMG_2537.jpg 404 (Not Found) photos.html:78 

確保您的照片是在圖像顯示正確的位置。

我發現這是Console feature in Google Chrome,我可以建議使用它來開發和測試網站。

+0

Woops。謝謝! – user2876702

+0

@ user2876702不用擔心,如果是你的回答請標記爲答案:) – AaronHatton

0

將您的javascript源文件包含在body標籤中,您可能會包含兩個jquery文件。我也面臨這個問題,它在我的本地主機上工作,但不在活服務器上,然後我刪除了第二個qquery包含,它開始工作。

我希望這個作品

例子:

<body> 
    <script type="text/javascript" src="js/jquery-2.1.4.min.js"></script> 
    <script type="text/javascript" src="js/jquery-1.1.0.min.js"></script> 
    <!--find the second jquery file and remove it--> 
    </body