473,473 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

selection object

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
3 1430
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
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
That works!

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Martin Karlsson | last post by:
Hi guys, Does anyone know how I can restore a selection created with createRange()? The problem is that I have a function that opens a new window with window.open() which of course makes the...
1
by: Jeff Thies | last post by:
Is there a NS7, Opera7 or Mozilla equivalent for: document.selection.createRange(); Jeff
15
by: lawrence | last post by:
Is this the correct way to test for a method before I use it? createRange() is, I believe, an IE only method. function wrapSelectionInTag(selection, tag) { if (document.selection.createRange)...
3
by: john woo | last post by:
Hi if sel represents a select object, then var length = sel.length; var aValue = sel.option; var aIndex = sel.selectedIndex; I'm wondering what's idea to manipulate this sel, like
1
by: youngie | last post by:
I've got a listview on a form in report style. It's populated with 40 item. I want to prevent the used clicking on some items, and if the user clicks on one of these items I want the selection to...
5
by: STeve | last post by:
Hey guys, I currently have a 100 page word document filled with various "articles". These articles are delimited by the Style of the text (IE. Heading 1 for the various titles) These articles...
6
by: Fnord Nase | last post by:
Hi. We're using the dblclick event in some parts of a web app interface, which works okay, but when a user double clicks on a text element, the browser selects some text before executing the...
5
by: Jure Bogataj | last post by:
Hi all! I have a problem (performance issue) with listview. I have implemented an ItemSelectionChange on my listview and put some code in it (I build some toolbar based on selection and update...
1
by: HarishAdea | last post by:
Hi, I am trying to run the JAVA pgm, but it is giving error as "selection does not contain a main type". The filename is "ScoreLeadSummary.java" when i try to run it or debug,it gives the pop...
2
by: vanditnagar | last post by:
Hi, I am facing the difficulty in the selecting a text on the browser . And highlighting the text. I am using the window.getSelection() to get the object and after...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.