[英]JavaScript image slider/catalog
因此,我正在嘗試制作一個簡單的圖像“目錄”,以便在其中循環顯示某些圖像。 這是代碼: http : //pastebin.com/raw/NDh4VBtz目前,我面臨兩個問題:
文件的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.