-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascript.js
48 lines (42 loc) · 1.16 KB
/
javascript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var images = ['Runner', 'runner.png', 'Obamicon', "obamicon1.png", 'Obamicon Product','obamicon2.png', 'Ball Game', 'ball.png', 'Snow Animation', 'snow.png'];
i=0;
function showText(name){
var source = document.getElementById(name);
source.src = name + 'text.png';
}
function showImage(name){
var source = document.getElementById(name);
source.src = name + '.png';
}
function nextPic(){
var currentCap = document.getElementById("caption");
var currentIm = document.getElementById("currentimage");
i +=2;
length = images.length;
if (i>= length){
i=0
}
currentCap.innerHTML = images[i];
currentIm.src = images[i+1];
currentIm.style.width = '600px';
currentIm.style.height = '400px';
}
function prevPic(){
var currentCap = document.getElementById("caption");
var currentIm = document.getElementById("currentimage");
i -=2;
length= images.length;
if (i<0){
i= length-2;
currentCap.innerHTML = images[i];
currentIm.src = images[i+1];
currentIm.style.width = '600px';
currentIm.style.height = '400px';
}
else {
currentCap.innerHTML = images[i];
currentIm.src = images[i+1];
currentIm.style.width = '600px';
currentIm.style.height = '400px';
}
}