<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2734.1600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>I'm writing a masked edit textbox control for HTML 
(client-side script only).&nbsp; I have everything working okay except that I'm 
using the onkeyup event to reformat the text.&nbsp; In this case, I allow only 
numeric input, but I format it as (nnn) nnn-nnnn for telephone numbers.&nbsp; 
The problem comes when I use shift and the left or right arrows to select a 
portion of the text, and also when I first tab into the textbox and the entire 
text is selected by default.&nbsp; The onkeyup event formats the text properly, 
but in the process it deselects the selected text.&nbsp; I can try to circumvent 
this by trapping for particular keystrokes, i.e. tab, downshift, etc. and 
skipping the formatting.&nbsp; But I would like to know, for the record and for 
possible later needs, how to detect the selected text and reselect it after 
formatting.&nbsp; </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>In VB6 windows controls there are two properties, 
SelStart and SelLength, that tell where the selected text begins and how long it 
is.&nbsp; Does anyone know of a means of determining the same information 
regarding an HTML input of type text?&nbsp; I'm aware of the onselect event, but 
I can't find any helpful properties associated with it.&nbsp; Nor do the event 
object or its srcElement have anything helpful in this regard.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Does anybody have a 
solution?</FONT></DIV></FONT></DIV></BODY></HTML>