473,782 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with FF2.0 trying to find the y offset of an object.

verbatim
7 New Member
I’m having a problem with FF2.0 trying to find the y offset of an object.

I've tried several different scripts; all seem to be similar to this one. I keep getting strange values for the Y offset. In stylesheets, I set everything to zero: body { padding:0px; margin:0px }. then placed one single image on a blank page with an href around it. using mouseover to show me the y offset, I keep getting different y offsets depending on the height of the image (manually changed for experimentation ). The natural height of the image is 88, yet somehow the offset keeps saying 73.

If I have set everything to zero: 1. shouldn’t the offset always be zero? 2. why does the y offset change every time I change the image height?

Strangely, when the image path had a typo and no image appeared, this displays the correct y offset. place your test image in place of: testImageHere

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<head>
<title>obj pos</title>

<script type="text/Javascript">

function findPos(obj) {
var curleft = 0;
var curtop = 0;
if (obj.offsetPare nt) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParen t) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}

}
alert ("x="+curleft+" , y="+curtop);
}

</script>

<style>
body { padding:0px; margin:0px; }
.container { padding-top:0px; padding-left:0px; }
</style>

</head>
<body>

<div class="containe r">

<a href="#" onclick="findPo s(this);"><img src="images/testImageHere.g if" alt="test" width="96" height="88" border="0" /></a>

</div>

</body>
</html>[/HTML]
Feb 15 '07 #1
1 1215
acoder
16,027 Recognized Expert Moderator MVP
This page might help.
Feb 16 '07 #2

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

Similar topics

13
2212
by: JasBascom | last post by:
int main() { char record_typec = 'c'; record_typec = toupper(record_typec); * rec->Newcrecord.record_type = record_typec; etc etc \*********************************************\
3
2403
by: Muhammad Farooq-i-Azam | last post by:
Hi, I am trying to define an arp structure but having problem doing so. I think I have define the correct arp structure but I find myself in a strange problem. The size of structure that I have defined is 28 bytes, but it is reported to be 32 bytes by the sizeof() call. Interestingly, sum of individuals members of the sturcture is 28. However, the sizeof() the entire structure is returned to be 32.
0
3941
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
5
1175
by: Jay | last post by:
I am trying to code an application that will move a image around the screen depending on what arrow keys the user presses. If the user presses the up key, the graphic will move up a few positions, and so on. I was wondering how I would move the image though, it seems that when I try to change the X and Y values in the position property, nothing happenes. I must be changing the wrong property, but I don't know where to find the one that...
5
1389
by: Chuck Gantz | last post by:
I'm using vb2005. I wrote a simple app to view and print all the fonts on my pc.To see how the printout will look without wasting lots of paper, I use PrintPreviewDialog. The first time I run PrintPreviewDialog, it correctly shows five pages of printout. If I run it a second time, it only shows three pages, with the original second page printing over the original first page. If I run it a third time, only one page shows up, with all...
1
17551
by: Mr. Beck | last post by:
Hello, Please Help..... I have been working with some tcp/ip socket communication within a C# program recently. Basicly, I have a program (myProblemProgram) that has a socket connected to another program for information passing. Upon receiving a particular "command" from the the information passing program, myProblemProgram will launch a separate thread to do individual communication with another file transfer program. The thread...
3
2079
by: Harry | last post by:
#include<stdio.h> #include<stdlib.h> #include<malloc.h> void scramble(void); struct bmp_header { short int sig; int size_bmp;
0
3491
by: shahiz | last post by:
This the error i get when i try to run my program Error: Unable to realize com.sun.media.amovie.AMController@18b81e3 Basically i have a mediapanel class that initialize and play the media as datasource import java.awt.BorderLayout; import java.awt.Component; import java.io.*; import java.net.URL; import javax.media.*;
2
6596
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
10313
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...
1
10080
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
8968
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...
1
7494
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
6735
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
5378
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
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.