<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>index</title>
<script language="javascript">
<!--
var interval= 1500;
var random_display=0;
var imageDir="my_images/";
var imageNum=0;
imageArray=new Array();
imageArray[imageNum++]=new imageItem(imageDir+"DSC_0144.png");
imageArray[imageNum++]=new imageItem(imageDir+"DSC_0145.png");
imageArray[imageNum++]=new imageItem(imageDir+"DSC_0146.png");
imageArray[imageNum++]=new imageItem(imageDir+"DSC_0147.png");
imageArray[imageNum++]=new imageItem(imageDir+"DSC_0148.png");
var totalImages=imageArray.length;
function imageItem(image_location){
this.image_item=new Image();
this.image_item.src=image_location;
}
function get_ImageItemLocation(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{
image=(imageNum+1)%totalImages;
}
var new_image=get_ImageItemLocation(imageArray[imageNum]);
return(new_image);
}
function getPrevImage(){
imageNum=(imageNum-1)%totalImages;
var new_image=get_ImageItemLocation(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="my_images/" src="my_images/DSC_0144.png" width="500" height="332" border="0" />
<a href="#" onclick="switchImage('my_images')">play slide show</a>
<a href="#" onclick="clearTimeout(timerID)">pause</a>
<a href="#" onclick="prevImage('my_image'); clearTimeout(timerID)">previous</a>
<a href="#" onclick="switchImage('my_image'); clearTimeout(timerID)">next</a>
<body onload="switchImage('my_image')">
</body>
</html>
Registrerte brukere: Google [Bot]