我想弄清楚为什么这个简单的代码不起作用。我正在实施这个:
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>
我是编码的新手,想知道是否存在语法错误......所有图像都在正确的位置。我不明白为什么这不起作用!
任何帮助都将不胜感激。
答案 0 :(得分:1)
您的doc类型在哪里以及打开html和head标签?也许你只是没有在这里包含它们,但要确保它们不会丢失在你的文档中。除此之外,请检查浏览器的JavaScript控制台,看看是否抛出错误。如果你是,请发布给所有人看。
答案 1 :(得分:0)
我复制了您的代码并更改了图像路径(演示:jsfiddle.net/hJKMy/)。 您的图片路径可能不正确。