title: Javascript Timer Problem
body: <p>My timer wont display anything, I think it has something to do with the insertBefore function but I am not sure. Any ideas on why it doesn't display any numbers in my span?</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function timeMsg()
  {
  var t=setTimeout("displayMsg()",5000);
  }
  function displayMsg()
  {
  document.getElementById("timeoutmsg").style.display = 'block';
  }
  
  COUNTER_START = 60
  
  function tick () {
      if (document.getElementById ('counter').firstChild.data &gt; 0) {
          document.getElementById ('counter').firstChild.data = document.getElementById ('counter').firstChild.data - 1
          setTimeout ('tick()', 1000)
      } else {
          document.getElementById ('counter').firstChild.data = 'done'
      }
  }
  
  if (document.getElementById) onload = function () {
      var t = document.createTextNode (COUNTER_START)
      var p = document.createElement ('P')
      p.appendChild (t)
      p.setAttribute ('id', 'counter')
  
      var body = document.getElementsByTagName ('timer')[0]
      var firstChild = body.getElementsByTagName ('*')[0]
  
      body.insertBefore (p, firstChild)
      tick()
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="timeoutmsg" style="border: solid 2px black; background-color: #69F; width: 300px; height: 100px; text-align: center; position: absolute; display: ; left: 40%; top: 40%; z-index: 1;" &gt;Your Session will expire in  &lt;span id="timer"&gt;&lt;/span&gt; Click Here to Contine or you will be logged out.&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>