Re: Deselecting text in input text box
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Deselecting text in input text box

From: VK <schools_ring@yahoo.com>
Date: Mon Feb 27 2006 - 22:25:59 CET

len.hartley@gmail.com wrote:
> 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.

There was an old exploit by clearing value and by setting it again. I
have no time to check if it's still ticking, sorry:

var fld = document.forms['myForm'].elements['myField'];
var tmp = fld.value;
fld.value = '';
fld.value = tmp;
Received on Mon May 1 03:40:11 2006