!Mozilla and caret in textarea

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zbigniew Braniecki

    #1

    !Mozilla and caret in textarea

    Hello.
    I'm looking for any way to grab caret position in textarea (start, end -
    if selection) in Internet Explorer. Is it at all possible?

    Also any idea for doing it in Opera, KHTML would be appreciated :)

    Greetings
    Gandalf

  • Martin Honnen

    #2
    Re: !Mozilla and caret in textarea



    Zbigniew Braniecki wrote:

    [color=blue]
    > I'm looking for any way to grab caret position in textarea (start, end -
    > if selection) in Internet Explorer. Is it at all possible?[/color]

    You subject asks about Mozilla, there (from 1.3 on) you can use

    var textarea = document.forms[0].elements[0];
    alert(textarea. selectionStart + '; ' + textarea.select ionEnd);




    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Zbigniew Braniecki

      #3
      Re: !Mozilla and caret in textarea

      U¿ytkownik Martin Honnen napisa³:

      [color=blue]
      > You subject asks about Mozilla[/color]

      My subject asks about NOT Mozilla :) Gecko is the only engine where i
      know how to do it :)

      But in IE? Cannot find a way :(

      Greetings
      Zbigniew Braniecki

      Comment

      • Martin Honnen

        #4
        Re: !Mozilla and caret in textarea



        Zbigniew Braniecki wrote:
        [color=blue]
        > U¿ytkownik Martin Honnen napisa³:
        >
        >[color=green]
        >> You subject asks about Mozilla[/color]
        >
        >
        > My subject asks about NOT Mozilla :) Gecko is the only engine where i
        > know how to do it :)[/color]

        Looked like a typo to me, didn't expect any JavaScript operators applied
        in a normal language sentence :)
        [color=blue]
        > But in IE? Cannot find a way :([/color]

        http://www.faqts.com/knowledge_base/...d/1052/fid/130

        --

        Martin Honnen
        http://JavaScript.FAQTs.com/

        Comment

        • Michael Winter

          #5
          Re: !Mozilla and caret in textarea

          On Wed, 14 Jan 2004 15:53:20 +0100, Zbigniew Braniecki
          <nightcat@poczt a.onet.pl> wrote:
          [color=blue]
          > U¿ytkownik Martin Honnen napisa³:
          >[color=green]
          >> You subject asks about Mozilla[/color]
          >
          > My subject asks about NOT Mozilla :) Gecko is the only engine where i
          > know how to do it :)[/color]

          In the future, it might be better to use English, rather than logical
          operators, to define your meaning.

          The TextRange object might be useful, but as I've never used it, I
          couldn't say. It seems to be the only relevant item.

          Mike


          From the DHTML Reference in the MSDN Library (beware of URL wrap)

          The TextArea object:
          http://msdn.microsoft.com/workshop/a...s/textarea.asp

          The TextRange object:
          http://msdn.microsoft.com/workshop/a..._textrange.asp

          --
          Michael Winter
          M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

          Comment

          • Zbigniew Braniecki

            #6
            Re: !Mozilla and caret in textarea

            U¿ytkownik Martin Honnen napisa³:
            [color=blue]
            > http://www.faqts.com/knowledge_base/...d/1052/fid/130[/color]

            This allows me to put text into textarea at caret position.
            I don't want to do this. I want to grab position of caret. Similar as
            textarea.select ionStart property in Gecko.

            Greetings
            Zbigniew Braniecki


            Comment

            Working...