Paste: Blinking led

Author: Sam
Mode: html
Date: Wed, 2 Dec 2009 18:11:16
Plain Text |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title>Blinking LED</title>
<style type="text/css">
h1   { text-align: center }
.on  { color: green }
.off { color: red }
</style>
<script language="JavaScript">
function blink() {
  var on = 1;
  var led = document.getElementById("led");
  window.setInterval(function () { on = 1 - on; led.className = on ? "on" : "off"; }, 1000);
}
</script>
</head>

<body onLoad="blink()">
<h1 id="led" class="on">I am a blinking LED</h1>
</body>
</html>

New Annotation

Summary:
Author:
Mode:
Body: