-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
27 lines (26 loc) · 882 Bytes
/
index.html
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
<html>
<body>
<script>
// number of images of rocks
var N = 118;
var i;
var text = "";
var random_images_array = [];
for (i = 1; i <= N; i++) {
random_images_array.push("rocks"+i+".jpg")
}
function getRandomImage(imgAr, path) {
path = path || 'images/'; // default path here
var num = Math.floor( Math.random() * imgAr.length );
var img = imgAr[ num ];
var imgStr = '<img src="' + path + img + '" alt="a rock">';
document.write(imgStr);
document.close();
}
</script>
<center>
<h2>Hellmouth Rocks</h2>
<script type="text/javascript">getRandomImage(random_images_array);</script>
</center>
</body>
</html>