The title of this page is adopted from Diego Perini since he has a very interesting and simple solution to detect whether the DOM Tree is ready and safe to be modified before the window.onload Event is fired. In his code, he used Element.doScroll to check whether the DOM tree of document is available for manipulation, which sounds a little strange and tricky to me until I had revisited the MSDN's