473,769 Members | 4,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1587

ta*****@gmail.c om 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.c om 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
5479
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 = getTagsArray("SPAN"); //make something with tag... }
5
5784
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 ugly. SO, I am looking for a "cross browser" "general" stylesheet that can be apply to a general HTML page.
17
1791
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... According to a recent survey (http://www.weboptimiser.com/search_engine_marketing_news/3061148.html), Internet Explorer has just under 95% of the browser marketplace. Do you think it's worth the additional aggravation of making things work in
2
1407
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 viewing the page with the latest version of firefox. I copy-pasted the page source to an html file and opened it with firefox and the styles were applied to the button with no problem. My question is then this: Is there a way to control what...
2
3692
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 old Java client/server data maintenance program to the web - the main display is in a grid format, which allows the user to select multiple rows and edit them in a new grid, which processes each grid line individually and validates and saves the...
9
5444
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 answer or solution for this? I'm trying to do this: top.frames.location.reload(); Thanks Mark Howells www.permanenttourist.ch
15
2329
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, FireFox, and Safari). We've made heavy usage of the new MENU control and other intrinsic 2.0 controls.... nothing fancy! just using ASP.NET's built-in controls and very nice, pervasive, and clean usage of CSS. Now I find after more testing that the...
1
2039
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 is even displayed in the field. Is there a working implementation anywhere? And how about denial of cross-browser pasting? On Windows a popup menu appears with the clipboard pasting options and I'd like to disable that and CTRL-V in an INPUT...
6
8635
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 tried, including my conclusions/assumptions (which i'll happily be corrected on if it solves my problem!): The requirement not to use a proxy means I can't use the synchronous
13
3389
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 decided to write an external application to do the work from the client side. We are not sure how the web page can call the app though with parameters. For example, we want to do similar to what the MSDN Library and Audible are doing with...
0
9586
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10043
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
9990
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
9861
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
6672
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
5298
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
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
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
3
2814
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.