"Rob" <reply_@news_gr oup.please> wrote[color=blue]
> Is it possible to get which text in a textarea element is selected ?[/color]
The function below returns any selected text (in IE, Netscape and iCab). Or
if no text is selected, null is returned. You have to do additional tests to
see if it is in the textarea. You should call this function onmousedown and
not onclick, because that may unselect the selection.
>>Is it possible to get which text in a textarea element is selected ?
[color=blue]
> The function below returns any selected text (in IE, Netscape and iCab). Or
> if no text is selected, null is returned. You have to do additional tests to
> see if it is in the textarea. You should call this function onmousedown and
> not onclick, because that may unselect the selection.
>
> function isselect(){
> if((d=document) .getSelection)r eturn d.getSelection( );
> if(d.selection && d.selection.cre ateRange)return
> d.selection.cre ateRange().text ;
> return false;
> }[/color]
I would be happier with the function if it looked like this:
function isselect() {
var d = document;
if (d.getSelection ) {
return d.getSelection( );
} else if (d.selection && d.selection.cre ateRange) {
return d.selection.cre ateRange().text ;
}
return false;
}
"Rob" <reply_@news_gr oup.please> schreef in bericht
news:vPq2c.1733 $pN4.1267@amsne ws03.chello.com ...[color=blue]
> Hello all
>
> Is it possible to get which text in a textarea element is selected ?
>
> If so How?
>
> Thanks Rob
>
>
>[/color]
Comment