Onload method

take a look at this code for a moment…

window.onload = function()

{
calendarTableElement = document.getElementById(‘calendar’);
todayDate = new Date;

loadCalendarAroundDate(todayDate);
setInterval('poll()', 100);

}

There is something I do not understand…
First:
I assume the onload event fires once…when the page is loaded.Am I correct.
Further down in the code you will se setInterval calling poll()

The weird thing is that poll() is being called continuously…how can that be since onload event is fired only once…unless of course it does not matter.

The function is called once the page is loaded but its the setInterval method that continuously repeats once the function has been called.

Rather than tying up the onload event you could put your scripts at the end of the html instead.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.