David wrote:
I want to be able to empty the
selection every time the user clicks a certain area, thus making it
impossible to select any text in that area.
Well JavaScript in the DOM mostly works on elements and other nodes and
not on "areas" but if you for instance have a <div> element and you want
to prevent that the user selects text inside the <div> element then you
can do that with
<div onselectstart="return false;"
style="-moz-user-select: none;">
<p>Kibology for all.</p>
<p>All for Kibology.</p>
</div>
for IE (with the onselectstart="return false;") and for Mozilla (with
the CSS extension -moz-user-select: none;).
There is no need to try to manipulate/empty the selection with script.
--
Martin Honnen
http://JavaScript.FAQTs.com/