Re: viewable coordinates of an element



i need the coordinates to display a tool tip div on that text field if
that makes more clear
On Oct 26, 7:28 pm, steven acer <dudest...@xxxxxxxxx> wrote:
lol sorry about that flubbed intro ! it's just that i'm really new to
javascript and web design as a whole, i'm just writing a small
online help module for an application i'm currently working on so i
might use the wrong terms sometimes.

anyways, i hope i was able to explain my situation here because what
you're suggesting simply yields
scrollLeft=0 and scrollTop=0 in FF 2.0 and in IE 7.

let me reform just a bit:
here's my code first
<div id="content">
..
<input type="text" id="dec_cod"
onKeyDown="showHelp(event);return(false);"/>
</div>

when the text field is scrolled into view either as a result of a
user's action or via javascript, i want
to calculate the coordinates of the point in the page that sits on the
top left corner of the newely visible text.
i have tried calculating the offsetTop of the element with respect to
the HTML element but it yielded the exact Y coordinate on the page.
dammit i guess this is an even more clunky explanation, anyway thanks
for your time man.

Thomas 'PointedEars' Lahn wrote:
steven acer wrote:
i have an INPUT element inside a scrolling DIV.initially the element's
position is off screen or off the viewable part of it
and has coordinates as follows X=223 Y=2225.
Is there a way to like when i scroll the DIV to this element,
calculate the "viewable" coordinates if the element with respect to
the page.
example: when i scroll to it i would expect a Y (if vertically ) value
<= page height but i always get the offscreen coordinates

You are looking for the scrollLeft and scrollTop properties of the DIV ...
and someone who teaches you how to write text in an easily legible way.

http://jibbering.com/faq/

PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee


.



Relevant Pages

  • Re: Scrollable divs
    ... CSS will permit you to force a div to be scrollable instead of sizing to it's content. ... If the quality of the CSS section matches that of the Javascript section then that site is completely better off being left alone. ...
    (microsoft.public.scripting.jscript)
  • Re: how to obtain offsetLeft
    ... which is exactly what your "debug" div shows. ... if I scroll the content left, ... I actually don't think this meta header works; ... Prototype.js was written by people who don't know javascript for people ...
    (comp.lang.javascript)
  • Re: viewable coordinates of an element
    ... javascript and web design as a whole, ... online help module for an application i'm currently working on so i ... Is there a way to like when i scroll the DIV to this element, ... You are looking for the scrollLeft and scrollTop properties of the DIV ... ...
    (comp.lang.javascript)
  • setTimeout () moving div with iframe causing flicker in firefox only
    ... I have a horizontal scroll animation in javascript that works in IE ... The div ...
    (comp.lang.javascript)
  • passing parameter problems
    ... I'm designing a website in dreamweaver and I'm using JavaScript to ... The text is contained in <div> tags. ... The following set up works fine, calling moveParas which moves two div ...
    (comp.lang.javascript)

Loading