-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
50 lines (41 loc) · 1.04 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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Instant Drama</title>
<style>
#button {
display: block;
width: 392px;
height: 440px;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
background: url(button.jpg) no-repeat left top;
cursor: pointer;
}
#button:hover:active {
background-position: right top;
}
</style>
</head>
<body>
<a id="button"></a>
<script>
function playNew() {
var tag = document.createElement('audio');
tag.setAttribute("preload", "auto");
tag.setAttribute("autoplay", "autoplay");
tag.setAttribute("src", "inception.mp3");
tag.addEventListener('ended', function () {
this.remove();
});
document.body.appendChild(tag);
}
document.getElementById('button').addEventListener('click', playNew);
</script>
</body>
</html>