x and y position of an html tag

  • Thread starter Giuliano Dal Forno
  • Start date
G

Giuliano Dal Forno

Hello, I wanted to know if there is a way, through javascript or by html
directly, to get x and y coordinates position of an html tag in the
document window. Thanks to anyone who will help me!!!
 
R

rf

Giuliano Dal Forno said:
Hello, I wanted to know if there is a way, through javascript or by html
directly, to get x and y coordinates position of an html tag in the
document window. Thanks to anyone who will help me!!!

HTML does not "do" anything. Javascript does.

You mean element, not tag.

You probably mean DOM object, not element.

Er, why exactly do you want to know this? The answer to this question will
probably allow us to supply a better solution to your unspecified problem
:)

Cheers
Richard.
 
G

Giuliano Dal Forno

The problem I have is, probably, a bug of Netscape: my page is composed by a
menu, on the left-side, and an iframe, which is the target of every menu
link. With Internet explorer I can move through internal links (<a
href="#somewhere_in_this_document>">Go There</a>) of the html document shown
in the iframe with no problems, while i can't do that with Netscape. So I
wanted to "force" the main window scrollbar to scroll to the anchor named
"somewhere_in_this_document" of the iframe, but i have to know the y
position in the page of that anchor. Is there a way to do that with
javascript? Thanks
 
H

Hywel Jenkins

Giuliano Dal Forno said:
Hello, I wanted to know if there is a way, through javascript or by html
directly, to get x and y coordinates position of an html tag in the
document window. Thanks to anyone who will help me!!!

HTML "tags" don't appear in the document window unless you've
specifically coded them using the entity codes for the angle brackets.

What you really want to do is find the location of a particular object
on the screen, don't you? HTML certainly won't do it, JavaScript may
be able to.
 
R

rf

The problem I have is, probably, a bug of Netscape:

More likely an error on your page. Have you validated it?
my page is composed by a
menu, on the left-side, and an iframe, which is the target of every menu
link.

Oh my. Iframes are so last century.
With Internet explorer I can move through internal links (<a
href="#somewhere_in_this_document>">Go There</a>) of the html document shown
in the iframe with no problems, while i can't do that with Netscape. So I
wanted to "force"

There is no such thing as "force". You can only "suggest".
the main window scrollbar to scroll to the anchor named
"somewhere_in_this_document" of the iframe, but i have to know the y
position in the page of that anchor.

I think your design is broken.
Is there a way to do that with
javascript?

Probably but it will not work for a lot of viewers.

Better to fix your design.

A URL would, at this point, be distinctly advantageous :)

Cheers
Richard.
 
D

DU

Giuliano said:
Hello, I wanted to know if there is a way, through javascript or by html
directly, to get x and y coordinates position of an html tag in the
document window. Thanks to anyone who will help me!!!


Dear Giuliano,

I agree with everything Richard and Hywel told you. I think you first
need to just mention the url of your page and then follow up with a
clear and clean description of what you want to achieve, to do. Your
initial post certainly seemed to me you were looking for a solution to a
non-mentioned difficulty.

In your case, assuming your page design is corect and markup syntax is
valid and impeccable, the solution to your difficulty could be to resort
to the scrollIntoView(true)
method which will work fine in MSIE 6 and Mozilla-based browsers. If we
could know more, I'm sure we could propose something more to the point
meeting your real webpage requirements. Iframe might not be best for
your page; I don't know. Measurements/calculations trans-frames and
precise positioning trans-frame can be done; is that necessary for your
webpage design goals? Impossible to say.
Here, I am convinced your page design needs to be examined first.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,282
Latest member
RoseannaBa

Latest Threads

Top