W3C error doc error? Output tag browser support.

Posted by ThomasReggi on Stack Overflow See other posts from Stack Overflow or by ThomasReggi
Published on 2011-01-07T02:28:50Z Indexed on 2011/01/07 4:53 UTC
Read the original article Hit count: 260

Filed under:

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

© Stack Overflow or respective owner

Related posts about JavaScript