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:
JavaScript part of the file:
<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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.