I have a text input box and I don't want the text to be selected either
when the user tabs to the item or if the user clicks on it.
Now the function below which I found from 2002 in the archive works
fine for IE 6 but it works in neither Netscape 7 nor Firefox 1.0.
I'm hoping some of you might have an alternative suggestion or insight
for Netscape and Firefox.
Code that works in IE6:
function clearSelection () {
if (document.selection)
document.selection.empty();
else if (window.getSelection)
window.getSelection().removeAllRanges();
}
<input type="text" name="theElt" onfocus="javascript: clearSelection()"
size="12" maxlength="20" readOnly style="margin: 7px 3px 0px 3px;
border: 0px;" />