Cursor position in SPAN element

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • robin9876@hotmail.com

    Cursor position in SPAN element

    In a HMTL Span element I have a mouseover event which calls a
    javascript function. How in this function can I get the cursor position?

  • Who

    #2
    Re: Cursor position in SPAN element

    <robin9876@hotm ail.com> asks[color=blue]
    > In a HMTL Span element I have a mouseover event which calls a
    > javascript function. How in this function can I get the cursor position?
    >[/color]

    There are no cursors in normal span elements, only in those with designMode
    and ContentEditable magic. You can still get the actual width of the
    characters though, for exampel by creating sub-spans and measuring their
    size or using text selection ranges. Then compare that to the mouse location
    and you will find the currently hovered letter. The return question
    therefore is which browsers you target as there are some standardization and
    performance issues here.

    hth
    ivo


    Comment

    • robin9876@hotmail.com

      #3
      Re: Cursor position in SPAN element

      How do I get the current mouse location?
      I am try target IE and Firefox.

      Comment

      Working...