473,387 Members | 1,573 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,387 software developers and data experts.

Retreiving Coordinates of Elements On A Page

I think javascript ans CSS is the solution for my problem. I wish to use
them to retreive the relative coordinates of an element on webpage and store
it in an text field on pressing a button. or preferably have the text boxes
continuously update with the coordinates as a I drag the elements around. I
have borrowed some code to move the elements but Im new to javascript and
need a few pointers or links to something along these lines.

Please check out my test page to see what I need to do and what Ive done so
far

http://www.iddsoftware.co.uk/test.php
Thank you
Ian
Aug 2 '06 #1
1 1177
Ian Davies wrote:
I think javascript ans CSS is the solution for my problem. I wish to use
them to retreive the relative coordinates of an element on webpage and store
it in an text field on pressing a button. or preferably have the text boxes
continuously update with the coordinates as a I drag the elements around. I
have borrowed some code to move the elements but Im new to javascript and
need a few pointers or links to something along these lines.
If you want to learn about element position, read here:

<URL: http://www.quirksmode.org/js/introdh.html >

Please check out my test page to see what I need to do and what Ive done so
far

http://www.iddsoftware.co.uk/test.php
The script is junk, some extracts below:
<script language="JavaScript1.2">
That may have serious repercussions in some browsers in certain
circumstances:
<URL:
http://groups.google.com.au/group/co...016d805f3dc13e
>

Ditch the language attribute completely and use the required type attribute:

<script type="text/javascript">

[...]
function drags(){
if (!document.all)
return
[...]

That test makes your script dependent on support for a very old,
proprietary and deprecated method, resulting in your script not working
in perhaps 30% of web browsers.

There are numerous other examples of very bad coding style, e.g.
document.onmouseup=new Function("dragapproved=false")

--
Rob
Aug 2 '06 #2

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

Similar topics

2
by: Oldchatterman | last post by:
Hello, in an application I measure a lot of 2d coordinates (x,y) of a pattern. This pattern consists of a set of points on grid with fixed pitches in x and y direction. These coordinates all...
2
by: Rainer Kugeland | last post by:
Two problems regarding coordinates: a) When I click in the screen then I can easyly find the element on the current corrdinates. But is there a way to find the elements which are behind the fist...
15
by: Tony Gahlinger | last post by:
I'm using my browser (Mozilla/5.0 Linux i686 Gecko/20031007 Firebird/0.7) to do some client-side image processing. I want to capture the sequence of coordinates a user clicks on in xxx.jpg in the...
1
by: phil cunningham | last post by:
I am new to C# and GDI+ so I may have missed a simple way of doing this. I am trying to use the mouse to pick object up by seeing if the mouse position is Inside the object. However, I am using...
8
by: Bob Bedford | last post by:
Hello, I've some geographical coordinates and I'd like to put them on a map. Example: I've the map of the USA. Once I've selected Chicago, I'd like a point-cross or what ever, on the Chicago...
1
by: Ian Davies | last post by:
I think javascript ans CSS is the solution for my problem. I wish to use them to retreive the relative coordinates of an element on webpage and store it in an text field on pressing a button. or...
26
by: pamelafluente | last post by:
Hi , I have a DIV element in a page with a lot of other stuff (the page can scroll several times) absolutely positioned: <div id="MyDIV" <br<brFooter </div> Just after the page load, I...
3
by: MarkusJNZ | last post by:
Hi all, I have a page which allows a user to drag and drop one or more images on a page. I have a function which is passed in a reference to the item being dragged so I can do things like; ...
1
by: i.sobha | last post by:
Hi, I tried retreiving an image from an access data base and display it to the asp page . The code is shown below. But the same is not working. Can someone provide me with some valuable...
0
by: raylopez99 | last post by:
keywords: logical coordinates, page coordinates, world coordinates, device coordinates, physical coordinates, screen coordinates, client coordinates. offset rectangle. WYSIWYG rubber rectangle...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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...

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.