Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Doctype Tag causing strange results

Status
Not open for further replies.

CliveC

Programmer
Nov 21, 2001
1,222
US
Can anyone in this forum shed any light on this:

thread216-465709

Thanks, Clive
 
With the new DOM that is used in IE6, there is no longer the "body" object. The scroll offset is found in the documentElement object.

When you take away the declaration, you're telling IE6 to "wing it" or in other words "Be promiscuous with interpretation". Since .body worked on old browsers and since you're not forcing it to hold to XHTML standards, then, as Cole Porter says, "Anything goes".

Here's the working stuff. I can't get it to work in Mozilla, though. I think there's some form of Space Herpes Incompatibility going on, or maybe just Microsoft spoiling us on software soma...

Anyway, enough rambling from a fella who has been known to talk the legs off an Arcturian mega-donkey. Here, code fat-free:

Code:
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;></html>[/URL]
<body><div onclick=&quot;alert(document.documentElement.scrollTop);&quot;> 
<br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br />
</div></body></html>

Cheers,

Edward &quot;Do not read this sentence.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top