title: window.onload works fine with aspx page, but not in regular html
body: <p>Could someone please explain to me why <code>window.onload</code> works fine in aspx, but not in xhtml?</p>
  
  <p>This <code>window.onload</code> example works fine in aspx:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
        //handles the collapse of submenu items on navigation side menu
  
   function toggle() {
  
       document.getElementById('node4').style.display = '';
  
   }
  
   window.onload = toggle;
  
  //]]&gt;
   &lt;/script&gt;
  </code></pre>
  
  <p>Yet this <code>window.onload</code> example doesn't work in XHTML 1.0 strict. (It doesn't instantly fire <code>countDownClock</code> when page is loaded ):</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     //&lt;![CDATA[
     //handles the collapse of submenu items on navigation side menu
  
     function countDownClock() {
         today = new Date();
         openingDay = new Date();
         openingDay.setMonth(2, 23);
         (today &gt; openingDay) ? openingDay.setFullYear(2013) : openingDay.setFullYear();
         openingDay.setHours(9, 0, 0, 0);
         document.getElementById("mallclock").dayNow.value = showDate(today);
         document.getElementById("mallclock").timeNow.value = showTime(today);
  
         var daysLeft = dayDiff(today, openingDay);
         var hoursLeft = hoursDiff(today, openingDay);
         var minutesLeft = minutesDiff(today, openingDay);
  
         daysLeft = ((hoursLeft - 24) &gt;= 0) ? daysLeft + (hoursLeft / 24) : daysLeft;
         hoursLeft = ((hoursLeft - 24) &gt;= 0) ? hoursLeft - ((hoursLeft / 24) * 24) : hoursLeft;
         hoursLeft = ((minutesLeft - 60) &gt;= 0) ? hoursLeft + (minutesLeft / 60) : hoursLeft;
         minutesLeft = ((minutesLeft - 60) &gt;= 0) ? minutesLeft - ((minutesLeft / 60) * 60) : minutesLeft;
  
         document.getElementById("mallclock").days.value = daysLeft;
         document.getElementById("mallclock").hours.value = hoursLeft;
         document.getElementById("mallclock").minutes.value = minutesLeft;
  
     }
  
     window.onload = countDownClock;
  
   //]]&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>It only fires the body event, which is set to show <code>countDownClock</code> 1 minute later</p>
  
  <pre><code>&lt;body onload = "setInterval('countDownClock()', 60000)"&gt;
  </code></pre>