473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

cross browser x,y

question I have never been able to solve since the 90s...

I want to find x, y location of a layer or an image, or any other item
on a webpage.

1. It could be relatively or absolutely positioned.
2. It does not matter what browser the user is using.

what's the correct javascript code?

example: find x, y location of the image "someImage"

<html>
<body>
......... some html here....

<img src="someImage.gif" id="someImage" />
......... some html here....
<body>
</html>

any help?

Aug 6 '06 #1
2 1572

ta*****@gmail.com wrote:
question I have never been able to solve since the 90s...

I want to find x, y location of a layer or an image, or any other item
on a webpage.

1. It could be relatively or absolutely positioned.
2. It does not matter what browser the user is using.

what's the correct javascript code?

example: find x, y location of the image "someImage"

<html>
<body>
........ some html here....

<img src="someImage.gif" id="someImage" />
........ some html here....
<body>
</html>
I use a program called ScreenCalipers that might be of use to you. You
can download a limited feature version for free at
http://www.iconico.com/caliper/v3upgrade.aspx . Paying for it will add
more features. You can measure the x and y distances between any two
points in px, cm, inches, or other units. A measurement from the left
of the screen to the start of an image will give the x coordinate for
the image, and measurement from the top of the screen to the top of the
image will give the y coordinate. You can also measure the width and
height of the image. I do not know exactly what code is used in the
ScreenCalipers program, but it seems to work well for me.

Aug 6 '06 #2
ta*****@gmail.com wrote:
I want to find x, y location of a layer or an image, or any other item
on a webpage.
1. It could be relatively or absolutely positioned.
2. It does not matter what browser the user is using.
I've written a fairly comprehensive cross-browser, cross-doctype,
layout-agnostic position script:
http://www.javascripttoolbox.com/lib/objectposition/

Hope it meets your needs.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Aug 7 '06 #3

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

Similar topics

4
by: Simba | last post by:
In some pages of my website I use a code like the following: for (var n = 0; n < getTagsArray("SPAN").length; n++){ //SPAN is just an example. I also use other tags tag =...
5
by: HchC | last post by:
Not looking for a special or fancy css stylesheet. For a HTML beginner, stylesheet is still far away from now. Not even said thinking about cross browser. But, an XHTML page without stylesheet look...
17
by: Mark Rae | last post by:
Hi, I'm interested in your opinion concerning how far you would consider it necessary to code for cross-browser compatibility these days, especially for public-facing Internet sites... ...
2
by: Eric Caron | last post by:
Hi everybody, I was doing some cross-browser tests today and I found out that if you specify the width and height for a button type control, asp.net doesn't output the style information when...
2
by: Questman | last post by:
Good afternoon, Does anyone have any code that implements, or approaches implementing, a cross-browser DHTML/JS solution to provide an Excel-like Grid on a web page - I'm trying to convert an...
9
by: permanent.tourist | last post by:
I'm having a hell of a job getting this to work in Safari: the only thing I can think of is that one can't use reload() across to another frame for security reasons. Does anyone have a concrete...
15
by: CMM | last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My superiors have decided that it would be nice if we ensured the site worked on all the major platforms (as they see it: IE,...
1
by: Rancid Buttchutney | last post by:
I've tried searching the web but I've had little success finding a cross-browser(IE, Firefox and Opera anyway) implementation of a restricted text INPUT that works in realtime before a character...
6
by: Simon | last post by:
Hi All, An experiment i'm doing requires requires a synchronous cross-domain request, without using a proxy. I wondered if anyone had any ideas to help me achieve this. Below is what I have...
13
by: Jeff | last post by:
We have an intranet website that currently uses ActiveX but we need to make it cross-browser compatible and also get around the problems we've been having with making it work with IE7 and Vista. We...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.