selection object

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

    selection object

    I am trying to achieve in Netscape what I can achieve in IE by
    document.select ion.empty(). This will remove the highlighting created by
    Ctrl A or by dragging over text on a page. I can access the selection object
    in NS using window.getSelec tion() but I have not found any way to clear it
    so as to remove the highlighting. I have tried the collapse() method but
    that does not do it. Any tips would be appreciated.
    thanks,
    Aidan


  • rh

    #2
    Re: selection object

    Aidan wrote:[color=blue]
    > I am trying to achieve in Netscape what I can achieve in IE by
    > document.select ion.empty(). This will remove the highlighting created[/color]
    by[color=blue]
    > Ctrl A or by dragging over text on a page. I can access the selection[/color]
    object[color=blue]
    > in NS using window.getSelec tion() but I have not found any way to[/color]
    clear it[color=blue]
    > so as to remove the highlighting. I have tried the collapse() method[/color]
    but[color=blue]
    > that does not do it. Any tips would be appreciated.[/color]

    window.getSelec tion.RemoveAllR anges(); perhaps? See:

    <url:http://www.faqts.com/knowledge_base/view.phtml/aid/7863>

    ../rh

    Comment

    • rh

      #3
      Re: selection object

      rh wrote:
      [color=blue]
      > window.getSelec tion.RemoveAllR anges(); perhaps? See:[/color]

      Er, not quite. Let's make that:

      window.getSelec tion().removeAl lRanges();
      as per the reference.

      ../rh

      Comment

      • Aidan

        #4
        Re: selection object

        That works!

        thank you so much, Aidan


        Comment

        Working...