好吧,這可能聽起來很愚蠢,但我想找到一個教程或代碼庫(JQuery,Mootools),允許您創建一個JavaScript幻燈片。有人可以向我解釋什麼是JQuery和Mootools的不同,以及它們的用途。另一個我不明白,如果我去找這些地方是否會幫助我做幻燈片放映。我已經有一個,但我的網頁無法正常工作。這裏是我的代碼謝謝look.I也爲
comfused我把highway12.jpg在那裏,但只給我1張照片,而不是幻燈片。javascript幻燈片
<head>
<title>Javascript Slideshow</title>
<script language="javascript">
<!--
var interval = 1500;
var randome_display = 0;
var imageDir = "my_images/";
var imageNum = 0;
var totalImages = imageArrays.length;
imageArray = new Array();
ImageArray[imageNum++] = new imageItem(imageDir + "highway12.jpg");
ImageArray[imageNum++] = new imageItem(imageDir + "lighthouse.jpg");
ImageArray[imageNum++] = new imageItem(imageDir + "landscape.jpg");
ImageArray[imageNum++] = new imageItem(imageDir + "shore.jpg");
ImageArray[imageNum++] = new imageItem(imageDir + "seashore.jpg");
ImageArray[imageNum++] = new imageItem(imageDir + "roughwaters.jpg");
ImageArray[imageNum++] = new imageItem(imageDir + "bigwave.jpg");
ImageArray[imageNum++] = new imageItem(imageDir + "sunset.jpg");
function imageItem(image_loaction) {
this.image_item = new Image();
this.image_item.src = omage_loaction;
}
function get_ImageItemLoacation(imageObj) {
return(imageObj.image_item.src)
}
function randNum(x ,y) {
var range = y - x + 1;
return Math.Floor(Math.random() * range) + x
}
function getNextImage() {
if(random_display) {
imageNum = randNum(0, totalImages-1);
}
else {
imageNum = (imageNum+1) % totalImages;
}
var new_image = get_ImageItemLaction(imageArray[imageNum]);
return(new_image);
}
function getPrevImage() {
imageNum =(imageNum-1) % totalImages;
var new_image = get_ImageItenLocation(imageArray[imageNum]);
return(new_image);
}
function prevImage(place {
var new_image = getPrevImage();
document[place].src= new_image;
}
function switchImage(place) {
var new_image = getNextImage();
document[place].src =new_image;
var recur_call = "switchImage(' "+place+"')';
timerID =setTimeout(recur_call, interval);
}
//-->
</script>
</head>
<body>
<img name="javascriptslid" src="highway12.jpg" width=400 height=300 border=5px align="middle"><br />
<a href="#" onClick="switchImage('slideImg')">play slide show</a>
<a href="#" onClick="clearTimeout(timerID)"> pause</a>
<a href="#" onClick="prevImage('slideImg'); clearTimeout(timerID)"> previous</a>
<a href="#" onClick="switchImage('slideImg'); clearTimeout(timerID)">next </a>
</body>
</html>