ddadmin
11-27-2006, 05:09 AM
Hi;
I'm trying to figure out a graceful way to overcome a bug in IE6 when it comes to setting the BODY element's CSS overflow property to "auto." A picture speaks a thousand words, so here goes:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test page</title>
</head>
<body>
<h2>In IE6 AND doctype=standards mode, horizontal scrollbar incorrectly appears when setting body overflow to "auto" via scripting.</h2>
<div style="height: 1000px"></div>
<script type="text/javascript">
var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
standardbody.style.overflow="auto"
</script>
</body>
</html>
Basically in IE6, a horizontal scrollbar appears for the document even though it shouldn't be there. This bug only occurs when an explicit doctype is declared at the top of the page in IE6. I've searched Google on this though apparently have yet to come across a solution. Anyone know a good fix?
I'm trying to figure out a graceful way to overcome a bug in IE6 when it comes to setting the BODY element's CSS overflow property to "auto." A picture speaks a thousand words, so here goes:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test page</title>
</head>
<body>
<h2>In IE6 AND doctype=standards mode, horizontal scrollbar incorrectly appears when setting body overflow to "auto" via scripting.</h2>
<div style="height: 1000px"></div>
<script type="text/javascript">
var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
standardbody.style.overflow="auto"
</script>
</body>
</html>
Basically in IE6, a horizontal scrollbar appears for the document even though it shouldn't be there. This bug only occurs when an explicit doctype is declared at the top of the page in IE6. I've searched Google on this though apparently have yet to come across a solution. Anyone know a good fix?