By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,961 Members | 1,803 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,961 IT Pros & Developers. It's quick & easy.

selection object

P: n/a
I am trying to achieve in Netscape what I can achieve in IE by
document.selection.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.getSelection() 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
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
rh
Aidan wrote:
I am trying to achieve in Netscape what I can achieve in IE by
document.selection.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.getSelection() 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.


window.getSelection.RemoveAllRanges(); perhaps? See:

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

../rh

Jul 23 '05 #2

P: n/a
rh
rh wrote:
window.getSelection.RemoveAllRanges(); perhaps? See:


Er, not quite. Let's make that:

window.getSelection().removeAllRanges();
as per the reference.

../rh

Jul 23 '05 #3

P: n/a
That works!

thank you so much, Aidan
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.