[英]JavaScript image slider/catalog
So i'm trying to make a simple image "catalog" where i can cycle through some images. 因此,我正在尝试制作一个简单的图像“目录”,以便在其中循环显示某些图像。 Here's the code: http://pastebin.com/raw/NDh4VBtz Im facing two problems at this moment: 这是代码: http : //pastebin.com/raw/NDh4VBtz目前,我面临两个问题:
JavaScript part of the file: 文件的JavaScript部分:
<script type="text/javascript">
var Images =
new Array("first.jpg", "second.jpg", "third.jpg", 0)
function imagesS(ImageId, TxtId, ImageArr, Direction) {
IndPos = 0;
if (Direction == "+1"){
IndPos += 1;
if (ImageArr.length == IndPos) {
alert("Last photo!");
} else {
document.getElementById(ImageId).src= ImageArr[IndPos];
document.getElementById(TxtId).innerHTML = "Text: <i>" + ImageArr[IndPos] + "</i>";
}
} else if (Direction == "-1"){
IndPos -= 1;
if (IndPos == "0" || IndPos == "-1"){
alert("Can't do that!");
} else {
document.getElementById(ImageId).src= ImageArr[IndPos];
document.getElementById(TxtId).innerHTML = "Text: <i>" + ImageArr[IndPos] + "</i>";
}
}
}
也许这样的事情对您有用: imageCatalog
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.