Internet Explorer 6 DOCTYPE Bug
Join the Discussion
Microsoft should be ashamed of themselves for not knowing what a DOCTYPE is.
A DOCTYPE defines the version of the HTML standards that has been followed in the coding of the HTML contained within the web page. Of course most if not all current web browsers ignore the DOCTYPE and parse the page based on their own predefined rules rather than the rules defined in the DOCTYPE. That is a problem that all current browsers share which presumably will be fixed in not too far distant future versions of the browsers.
A DOCTYPE is also used by validators to determine whether the HTML coded in the page follows the defined standard or not.
The problem arises because there are several different ways to refer to some parts of the Document Object Model as it relates to the page (eg. in determining scroll position). The standards say that you should refer to these parts of the DOM using document.documentElement but the traditional Microsoft way of accessing the same fields is using document.body. Of course other browsers used other non-standard ways to retrieve the same information but many had adopted the Microsoft way even before the standard way was developed.
If you use a Strict DOCTYPE you need to test both versions of a field in order to have get the values from document.documentElement in IE6 and from document.body in IE5 and other older browsers. Of course it doesn't matter which of the two fields we get in other modern browsers since they populate both sets of fields with the same values (the way Microsoft should have done). The simplest way to do this is to replace each reference with code that will substitute whichever of the two fields has been populated with a value. For the scrollTop field the simplest code to do this is: