2012-10-27 159 views
0

我想弄清楚爲什麼這個簡單的代碼不工作。我執行這樣的:簡單的JavaScript滑塊問題w/html

http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

這裏是我的代碼:

<script type="text/javascript"  src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 

<script type="text/javascript" src="fadeslideshow.js"> 

/*********************************************** 
* Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library  (www.dynamicdrive.com) 
* This notice MUST stay intact for legal use 
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more 
***********************************************/ 

</script> 

<script type="text/javascript"> 

var mygallery=new fadeSlideShow({ 
    wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow 
    dimensions: [750, 500], //width/height of gallery in pixels. Should reflect  dimensions of largest image 
     imagearray: [ 
     ["/images/allimages/vdance750x500.png", "", "", "Caption"], 
     ["/images/allimages/vpoca750x500.png", "", "", ""], 
     ["/images/allimages/vhat750x500.png", "", "", "" ], 
     ["/images/allimages/vdance750x500.png", "", "", ""] //<--no trailing comma  after very last image element! 
    ], 
    displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false}, 
    persist: false, //remember last viewed slide and recall within same session? 
    fadeduration: 500, //transition duration (milliseconds) 
    descreveal: "ondemand", 
    togglerid: "" 
}) 
</script> 


<title>Vanadia's Site</title> 





</head> 

<body> 

<div id="fadeshow1"></div> 

<br /> 


</body> 
</html> 

我是新來的編碼,不知道是否有語法錯誤......所有的圖像是在正確的點。我不明白爲什麼這不起作用!

任何幫助,將不勝感激。

+1

如果出現語法錯誤,您的調試器應該會告訴您。在Chrome,Opera或Firefox中點擊Ctrl-Shift-I。在ie中打f12。 – enhzflep

回答

0

我複製了你的代碼並改變了圖像路徑(demo:jsfiddle.net/hJKMy/)。 您的圖片路徑可能不正確。

1

你的文檔類型和打開html和head標籤在哪裏?也許你只是沒有在這裏包括它們,但要確保它們不會從你的文檔中丟失。除此之外,請檢查您的瀏覽器的JavaScript控制檯,看看您是否在拋出錯誤。如果你是,請張貼所有人看。