Using the TextRange object with the input controls provides complete control over the user's input. You can use the TextRange object for simple on-the-fly input validation and even formatting. We hope this article has introduced you to the TextRange object and a few techniques you can use to better control and validate user's input. You can find more information about the TextRange object in Chapter 14 of the book Inside Dynamic HTML or in Internet Explorer 4.0's SDK.
While Netscape Navigator 4.0 does support keyboard events on the input controls, there is no way (that we know of) in Netscape Navigator to build the demonstrated on-the-fly validation and formatting. While you can test a character as it is typed, there is no way to determine the location of the current insertion point and selection. Furthermore, any changes to the value of the text box causes the selection to be reset.
© 1997-2000 InsideDHTML.com, LLC. All rights reserved.