Anne van Kesteren

DOM internet beat

The Internet Beat is a new measure of time, meant especially for the internet. It divides the day into 1000 beats of 86.4 seconds each. It is written with an @ in front of it. The great advantage of it is that it offers a truly worldwide time, so that people in wildly different timezones can agree to mail each other "around @600".

Today I integrated "Time" in my sidebar. I find it useful but it was more a bit of practicing for my next DOM project at this site: "Choose style". I don't have time to continue at the Matrix style, which is already visible for Mozilla and Opera users (and probably more browsers). But when I have time again it will all be updated and there will be added new styles. The only thing I have to (maybe today) is to add noscript so that people now they're missing something.

Everything in javascript is generated from the outside script, not a little bit of HTML has changed. Nor did the CSS. And I'd like to keep it that way since I'm going to use more stylesheets. The only thing I need to find out is how you can apply javascript to the top of an element (now it's at the bottom), but that will be no problem. Otherwise I just leave it were it is.

Most of the scripting isn't written by me, why would you write something useful again(?) if it's done before, but I'll give the code (at the end of the post are the resources). The getBeat(); function:

function getBeat(){
 var now = new Date();
 var off = (now.getTimezoneOffset() + 60)*60;
 var theSeconds = (now.getHours() * 3600) + (now.getMinutes() * 60) + now.getSeconds() + off;
 var beat = Math.floor(theSeconds/86.4);
 if (beat > 1000) beat -= 1000;
 if (beat < 0) beat += 1000;
 return beat;

Another function I used and I need that function for the "Choose style" project I took from Simon Willison's Weblog: createElement();.

And as last (but not least..) my own (change menu in a div id of you choice):

function integrateIBeat(){
 var h2        = createElement("h2");
 var h2content = document.createTextNode("Time");
 var p         = createElement("p");
 var pcontent  = document.createTextNode("@"+getBeat()+"");

These three scripts should be in an external javascript file together with this onload function:

window.onload = function(){

If it doesn't work (I tested in Mozilla 1.5b & IE6) feel free to respond (don't forget to provide a working URI) and I will try to help you.


  1. Interesting stuff that...

    May come in handy for a future project

    Posted by Tim -huckan- Jackson at