Javascript Christmas Cards
Revision as of 14:59, 1 December 2011 by Michael Murtaugh (talk | contribs)
<!DOCTYPE html>
<html>
<head>
<script>
function domything () {
var x = document.getElementById("xmas");
// console.log("x is", x, x.currentTime, x.duration);
x.currentTime = x.duration / 2;
x.play();
}
function start () {
var x = document.getElementById("xmas");
x.addEventListener("durationchange", domything, false);
x.addEventListener("play", function () {
body =document.getElementsByTagName("body")[0];
body.style.background = "black";
}, false);
x.addEventListener("pause", function () {
body =document.getElementsByTagName("body")[0];
body.style.background = "";
}, false);
x.addEventListener("timeupdate", function () {
if (x.currentTime > 56) {
x.currentTime = x.duration / 2;
}
}, false);
}
document.addEventListener("DOMContentLoaded", start, false);
</script>
</head>
<body>
<center>
<video id="xmas" controls src="video/Prozim-Christmas863.ogv">No video support!</video>
<br />
Video by <a href="http://www.archive.org/details/Prozim-Christmas863">Utah Valley Handbell Choir</a>
</center>
</body>
</html>