Was looking at the reference page here : http://www.w3.org/TR/html5/offline.html
I copied and pasted the code on my server here in separate files. All of the pages are linked correctly but the clock won’t show. Just to double check, it wasn’t my “server config” I put it on jsfiddle.net here: http://jsfiddle.net/reggi/Dy8PU/.
Fails: MAC / FIREFOX 3.6.13
Wins: MAC / FIREFOX 4.0.b8
Is this dummy example code?
<!-- clock.html -->
<!DOCTYPE HTML>
<html>
<head>
<title>Clock</title>
<script src="clock.js"></script>
<link rel="stylesheet" href="clock.css">
</head>
<body>
<p>The time is: <output id="clock"></output></p>
</body>
</html>
/* clock.css */
output { font: 2em sans-serif; }
/* clock.js */
setTimeout(function () {
document.getElementById('clock').value = new Date();
}, 1000);
UPDATE:
-
The W3C code above works on only the NEWEST Beta releases of certain browsers
-
Below are some viable current javascript workarounds
Try this:
http://jsfiddle.net/Dy8PU/6/