473,586 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox offsetParent woes

I'm trying to select a row from a table in a 'dialog box' where the
HTML is (boiled down):

<body>
<div style='position :absolute; display:block;. ..'>
...other divs...
<div style='position :absolute...'>
...other divs...
<div style='display: block; overflow:auto; margin-left:auto;
margin-right:auto; width:...'>
<table style='width:10 0%;'>
<tr></tr>
<tr></tr>
</table>
</div>
...other divs...
</div>
</div>
</body>

Working upward through the chain of offsetParents to get
offsetTop and scrollTop works fine in IE. But FF skips the
overflow:auto div, it doesn't appear in the chain.

So, how do I get this to work correctly with IE and FF?

----
Geoff
Feb 12 '08 #1
2 2252
On Feb 12, 12:58*pm, Geoffrey Summerhayes <sumr...@gmail. comwrote:
I'm trying to select a row from a table in a 'dialog box' where the
HTML is (boiled down):

<body>
* <div style='position :absolute; display:block;. ..'>
The "display:bl ock" rule is redundant here.
* * ...other divs...
* * <div style='position :absolute...'>
* * * * ...other divs...
* * * * <div style='display: block; overflow:auto; margin-left:auto;
margin-right:auto; width:...'>
* * * * * *<table style='width:10 0%;'>
* * * * * * *<tr></tr>
* * * * * * *<tr></tr>
* * * * * *</table>
* * * * </div>
* * * * ...other divs...
* * </div>
* </div>
</body>

Working upward through the chain of offsetParents to get
offsetTop and scrollTop works fine in IE. But FF skips the
overflow:auto div, it doesn't appear in the chain.
That is because IE and FF implement offsetParent differently.
>
So, how do I get this to work correctly with IE and FF?
Are you trying to create a generalized solution? If so, see the
parentNode property. If not, just adjust for the scrollTop/Left
properties of the known scrolling container.

Feb 12 '08 #2
On Feb 12, 2:17*pm, David Mark <dmark.cins...@ gmail.comwrote:
On Feb 12, 12:58*pm, Geoffrey Summerhayes <sumr...@gmail. comwrote:
I'm trying to select a row from a table in a 'dialog box' where the
HTML is (boiled down):
<body>
* <div style='position :absolute; display:block;. ..'>

The "display:bl ock" rule is redundant here.
No big. It's coming from a combination of
stylesheet rules.
>
So, how do I get this to work correctly with IE and FF?

Are you trying to create a generalized solution? *If so, see the
parentNode property. *If not, just adjust for the scrollTop/Left
properties of the known scrolling container.
parentNode it is then, I'm trying to get as many
generalized sol'ns as possible to sit in one file
and cut down on the amount of specific javascript
that is required.

---
Thanks,
Geoff
Feb 12 '08 #3

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

Similar topics

4
6791
by: Keith Thornhill | last post by:
I'm trying to calculate the top and left distance from the side of the browser of an object (either absolutely or relatively positioned) and i'm running into a weird problem as i'm trying to make the code cross-browser. normally i simply use the .offsetLeft/Top properties of the object to get my numbers, and it is as simple as that. but in...
2
11209
by: Mark Szlazak | last post by:
The following code fails in Firefox to get at selected text in the right-side textarea. Any help would be appreciated. <html> <head> <script> var agt = navigator.userAgent.toLowerCase(); var safari = ((agt.indexOf('safari') != -1) && (agt.indexOf('mac') != -1))? true:false; var opera = (window.opera)? true:false;
1
4588
by: Mickey | last post by:
Hi, I have a script which works in both IE but is sluggish in Firefox. The script is a simple text scroller. It works perfectly in IE however in Firefox, the text scroll slower and eventually just stops. I would aprechiate it someone could look at the code below and maybe see where the problem is?
2
15803
by: amattie | last post by:
Anyone know what the specific difference is between the offsetParent and parentNode properties of a DOM element are? Mozilla's docs on the DOM element (http://developer.mozilla.org/en/docs/DOM:element) don't really indicate much of a difference, but whatever the difference is is really screwing me up in one of my projects. On a specific div...
1
2157
by: chris1606 | last post by:
This script floats one image over another (to conterract transparency). It works fine in Opera and Internet Explorer, but the image won't move in firefox. Any ideas how I can get it to work please? function move() { var curleft = curtop = 0; var obj = document.getElementById('pic1'); if (obj.offsetParent) { curleft = obj.offsetLeft;...
5
8098
by: webEater | last post by:
In XHTML mode (application/xhtml+xml) Firefox does not know offset properties (offsetParent/Left/Top). In all the other browsers it works. Does someone has the same problem or knows a solution for this? Example: .... <body> <div><div id="hello">Hey</div></div>
1
1828
by: inteli | last post by:
Hey anybody can help me out wid this code..Its working well in IE but nt in firefox.The problem lies in offset,clientX,clientY part but I dnt know how to resolve it .. var zxcDockAry=new Array(); var zxcBdy,zxcObj,zxcWDone,zxcWDCnt,zxcXos,zxcYos,zxcTD,zxcDiv; var zxcDragDo=false; function zxcInit(){ zxcBdy =...
3
4170
by: geetha v | last post by:
Hi All, I need a scrolling DIV is a to display my dynamic tree in left frame. In my jsp , Div overflow is set to "auto" <DIV id=divScroller style="overflow:auto;height:200px"> <!-- stuff goes here --> </DIV I'm using beleow function to set the height ..
10
2811
by: Humakt | last post by:
Hey all. It's been a while since I last visited. Short description of program: Board game which's html elements are fully constructed using DHTML/Javascript. Board is constructed of html table, and each table cell has one image (together the table forms a map/board). Players (2-4) each have their own pawns that float over the board using...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
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. ...
0
8339
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...
1
7965
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...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1184
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...

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.