473,815 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

overflow:auto issue in XHTML standards mode

I have a webpage that has 2 main DIVs - a title div and a content div.
I want the title dive to always "stick to the top of the page and

not scroll, regardless of the size of the window. The content div
should have a scrollbar that sits underneath the title div. I have

some event handlers in Javascript that handle calculating the size of
the content div.

Everything works fine in IE/Firefox when I remove the DTD from my
document (quirks mode) but in standards mode I get the scrollbar for
the

whole window and both the content div and title div scroll. The code
is below. If you comment out the DOCTYPE line to render in qirks

mode you will see the behavior I want.

So my question is: how can I get this page to appear the same way in
standards mode and quirks mode?

Any help on this is greatly appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>Ti tle</title>

<style type="text/css">
.contentBody
{
font-weight: normal;
font-size: 10pt;
margin: 0px;
color: #000000;
font-style: normal;
font-family: Arial, Helvetica, sans-serif;
background-color: #ffffff
}
</style>

<script type="text/javascript">
function Init()
{
if (window.addEven tListener)
{
// Mozilla/W3C
window.addEvent Listener('load' , handleResize, false);
window.addEvent Listener('resiz e', handleResize, false);
}
else if (window.attachE vent)
{
// IE
window.attachEv ent('onload', handleResize);
window.attachEv ent('onresize', handleResize);
}
}

function handleResize()
{
try {
var e = document.getEle mentById("eCont entDiv");
e.style.height = document.body.c lientHeight - eContentDiv.off setTop
+ "px";
e.style.width = document.body.c lientWidth + "px" ;
}
catch ( ex ) {
/**/
}
}
</script>

</head>
<body class="contentB ody" onload="Init(); ">

<form method="post" action="test.ht ml" id="frmMain">

<!-- banner -->
<div class="contentT itleBar" style="backgrou nd-color:#000099;
color:#FFFFFF; height:32px; width:100%; overflow:hidden ;">
<b>Title Content</b>
</div>

<!-- The Content DIV -->
<div id="eContentDiv " style="overflow :auto; width:100%;">
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
Content<br />
</div>
</form>

</body>
</html>

Oct 11 '06 #1
2 1803


ka******@hotmai l.com wrote:

So my question is: how can I get this page to appear the same way in
standards mode and quirks mode?
document.compat Mode tells you whether the page is being rendered in
quirks mode or standards mode.
In standards mode you should look at document.docume ntElement and not
document.body to find any offset.
<http://msdn.microsoft. com/library/default.asp?url =/workshop/author/dhtml/reference/properties/compatmode.asp>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 11 '06 #2
Thank you very much, this works in IE just like I needed. However,
This page is in an IFrame, and when the window is resized, the page no
longer puts the scrollbar under the "menu" div - it puts it on the side
of the broswer - although the JS code looks like it reporting the
correct size.

Is there any other trick if this page is to be the source of an IFrame,
and the broswer window is resized?

Christian

Martin Honnen wrote:
ka******@hotmai l.com wrote:

So my question is: how can I get this page to appear the same way in
standards mode and quirks mode?

document.compat Mode tells you whether the page is being rendered in
quirks mode or standards mode.
In standards mode you should look at document.docume ntElement and not
document.body to find any offset.
<http://msdn.microsoft. com/library/default.asp?url =/workshop/author/dhtml/reference/properties/compatmode.asp>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6385
by: matthewmacchia | last post by:
I believe this is a Firefox bug but I was hoping someone found a workaround. I have implemented drag and drop functionality, but if I try to drag an element from a div that happens to have a div with an "overflow: auto" it seems to lose the onmouseover event for my target. Anyone come across this issue and found a resolution? Please advise. Here is a link to my code.
4
23306
by: Harry | last post by:
I just implemented an "overflow: auto" for a div in the main message window: http://www.auriance.com/docs/interaction/ This works as expected in Internet Explorer and Opera, but in Firefox it doesn't. There shouldn't be a scrollbar on the page, but instead, on the div that shows the messages. Any idea? Thanks,
4
12554
by: reycri | last post by:
I have a page that works as I intend in IE but not in Firefox: <html> <head> <title>Overflow Test</title> </head> <body style='overflow:hidden; margin:0; padding:0;'> <table border='0' cellpadding='0' cellspacing='0' style='border-collapse:collapse; width:100%; height:100%;'> <tr><td colspan='2' style='height:3em; border-bottom:1px solid
2
515
by: kaczmar2 | last post by:
I have a webpage that has 2 main DIVs - a title div and a content div. I want the title dive to always "stick to the top of the page and not scroll, regardless of the size of the window. The content div should have a scrollbar that sits underneath the title div. I have some event handlers in Javascript that handle calculating the size of the content div. Everything works fine in IE/Firefox when I remove the DTD from my document...
3
19081
by: Otto de Voogd | last post by:
I posted the problem below in alt.www.webmaster before, but no-one knew the answer, however someone suggested this group as a good place to ask. I am trying to fit images into a browser window using CSS and in particular overflow:auto; The idea being that if a user's window is too small the image becomes scrollable (horizontally) and a horizontal scrollbar appears. It works nicely in Firefox and Opera but with Internet Explorer 7 a...
5
13373
by: vunet.us | last post by:
How can I hide scrollbars which appear in my floating div element with CSS property overflow:auto? I do need to use auto overflow. Thank you.
14
14293
by: MrPutty | last post by:
Hello everyone! It seems I've finaly found a place with savy folks ;-) The following problem has me puzzeled - hopefully someone can help me out! ------------------------------------------------ - head - ------------------------------------------------ - - - - m - - - e - -
1
1844
by: Jake Barnes | last post by:
I searched comp.lang.javascript on Google Groups but I didn't find an answer when I searched for "viewport" or "viewport div" or any combination of words using "viewport" so now I think I'm searching for the completely wrong thing. Perhaps someone can tell me what I should be searching for? I've got a div with overflow set to "auto": overflow:auto
4
5080
by: obanite | last post by:
Hi! I'm having issues with css in FF and IE regarding overflow: auto and font-size. If I have a div like this: <div style="overflow: auto"> <span>ipsumlorendictowhateveripsumlorendictowhateveripsumlorendictowhateveasdasdripsumlorendictowhateverasdasdasdjasjdioasjiosdjasiojdoasjisdojiasojdo </span> </div>
0
10672
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10428
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7687
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5710
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4359
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3888
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.