-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
85 lines (58 loc) · 1.79 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!-- Scene 2
Author: Keith Blackstock
University: WPI
License: Open Source usage allowed
-->
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta charset="utf-8"/>
</head>
<body>
<h1> First Page </h1>
<a href="test.html"> links second page </a>
<script>
var sound = new Audio();
var soundfile = "./file_example_MP3_700KB.mp3";
function playSound() {
sound.src = soundfile;
console.log("SOUND:" + sound.currentTime);
if (sound.currentTime == 0) {
var playPromise = sound.play()
}
}
function changeBGImage(imagefile, soundf){
if (document.body.background != "beam_lift.J.jpg" ) {
document.body.background = imagefile;
soundfile = soundf;
document.getElementById("audio1").click();
}
}
//changeBGImage("beam_lift.J.jpg","" ); // load start image
// event handler function
function handler(e) {
e = e || window.event;
var pageX = e.pageX;
var pageY = e.pageY;
// IE 8
if (pageX === undefined) {
pageX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
pageY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
console.log("hi Keith: " + pageX, pageY);
if (((pageX > 330) && (pageX < 550)) && ((pageY > 200) && (pageY < 700))) {
console.log("target1");
changeBGImage("highlight-kenza1.jpg","./file_example_MP3_700KB.mp3" );
} else if (((pageX > 640) && (pageX < 770)) && ((pageY > 220) && (pageY < 640))) {
console.log("target3");
changeBGImage("highlight-julia1.jpg","" );
} else {
changeBGImage("beam_lift.J1.jpg","" );
}
}
if (document.attachEvent) document.attachEvent('onmousemove', handler);
else document.addEventListener('mousemove', handler);
</script>
</body>
</html>