-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslideshow.js
44 lines (34 loc) · 875 Bytes
/
slideshow.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
//
// slideshow.js
//
// Slideshow of pictures
//
// C. David Sherrill, March 2018
//
window.onerror = function (msg, url, lineNo, colunmNo, error) {
var mainImage = document.getElementById("mainimage");
var ermsg = msg;
mainImage.innerHTML = ermsg;
return false;
}
window.onload = updateMainImage;
var whichSlide = -1;
// var Slides = ["pics/pic1.jpg", "pics/pic2.jpg"]
// alert("Got this: " + Slides[0] + " " + Slides[1]);
function updateMainImage() {
if (whichSlide == -1) {
whichSlide = Math.floor(Math.random()*Slides.length);
}
else {
whichSlide++;
}
if (whichSlide >= Slides.length) {
whichSlide = 0;
}
var mainImage = document.getElementById("mainimage");
mainImage.innerHTML = srcLine(Slides[whichSlide]);
setTimeout(updateMainImage, 10000);
}
function srcLine(filename) {
return '<img src="' + filename + '" />';
}