473,662 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting null value for div.offsetParen t in Mozilla.

1 New Member
In my code i am trying to access offsetLeft and offsetTop values for a element which is a div, I use offsetParent property to obtain the same. The code i use is

this.tip.style. left = this.handle.off setParent.offse tLeft + 'px';

After debugging i found the value of "this.handle.of fsetParent" is set to null.

I have problems with Mozilla firefox. The code works absolutly fine with IE

My questions :-

1. When do we get element.offsetP arent value as null.
2. Why do we get element.offsetP arent value as null.
3. What is the difference between parentNode and offsetParent properties, why one should not be used for the other.
Mar 28 '07 #1
1 3644
mrhoo
428 Contributor
offsetParent is an IE idiom.
this works in IE and the other browsers:
Expand|Select|Wrap|Line Numbers
  1. function whereAt(hoo){        
  2.     var T=0,L=0;    
  3.     while(hoo){
  4.         L+= ( hoo.offsetLeft)? hoo.offsetLeft: 0;
  5.         T+= (hoo.offsetTop)? hoo.offsetTop: 0;
  6.         if(hoo== document.body) break;
  7.         hoo= hoo.parentNode;
  8.     }
  9.     return [L,T];
  10. }
Mar 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1668
by: Jeff | last post by:
Hello all, I have an SQL Insert statement I'm trying to run via ExecuteNonQuery. It works fine so long as there are no nulls values. Here is the statement...(its a shortened version of what i actually have) MySQL = "Insert into Activity (ActivityName) Values ('" + GetString(2) + "')"; Here is the JIT Error..."Data is Null. This method or property cannot be called on Null Values"
3
1488
by: Akhenaten | last post by:
I have the following function which works great except when I encounter a NULL value in my array ($aidlook) and then I get "wrong data type" errors. I thought about doing a NULL check and creating a value but didn't know if there was a more effective method. TIA *************************** if (!in_array($userid, $aidlook)) {
1
2104
by: micdon143 | last post by:
In javascript, I have a function to add new tables. The id of the table is "myTable". When I tries to access it by using document.getElementById("myTable"), it is returning null... Please help
2
2422
by: preeti13 | last post by:
Hi guys i am here with my another probelm please help me.trying insert the value into the data base but getting the null value error .I am getting thsi error Cannot insert the value NULL into column 'EmployeeID', table 'Accomplishments.dbo.Accomplishment'; column does not allow nulls. INSERT fails. The statement has been terminated. and my code is this using System; using System.Collections;
5
2445
by: cdavii | last post by:
Anyone have an idea why i get null values when i import data from a ms spread sheet in a sql tbl. The table elemet(Spread sheet) in question contains alpha numerics. The sql table is populated with "NULL" when the value is numeric only. Example: A-ASP21A1-- imports perfect 6500012111-- results in "NULL" in the sql table element
13
2073
by: jcato77 | last post by:
I am having trouble figuring out my code and was hoping someone could point me in the right direction. Below is my code what I need to due is create a method to add and display the value of the entire inventory. I have what I think is the correct code but it's not working. Help is greatly appreciated class Inventory3 { public static final int MAXIMUM_ITEMS = 4; private static Product product = new Product; public static void...
6
1861
rajiv07
by: rajiv07 | last post by:
Hi to all I have an doubt on getting NULL value from mysql tables. If i fetch the null values it return empty string,Bt i want to get the NULL value as it is. Please Help on this. Regards Rajiv
0
1064
by: rajesh0303 | last post by:
Iam get null values in the datakeynames AlertID,ItemID while executing the Insert Command....I am Inserting using Externel button Event.Here is the code of Gridiew ,Its datasource and the button event......Need help.... <asp:GridView ID="GridView2" DataSourceID="SqlDataSource2" DataKeyNames="AlertID,ItemID" AutoGenerateColumns="False" runat="server" Width="839px" CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True"> ...
3
2554
dmjpro
by: dmjpro | last post by:
I am testing the value of document.body.offsetWidth in Mozilla and IE. IE gets the desired value but Mozilla is not getting the desired value. Actually what happens, i want to position an element at the right most of the screen.In IE the element positioned properly whether the screen has scroll or not, but Mozilla positions the element but not at the rightmost if the screen has scroll. Can anyone figure it out why it happens ?
0
8344
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8764
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
8546
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,...
0
8633
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
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
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.