PDA

View Full Version : Auto highlighting text in a textarea and text box


pthompson2002
08-30-2002, 09:38 AM
thanks for the help from Beetle and 'requestcode' with regard to the cursor position stuff, managed to get it working after initial hick-ups.

I was wondering if anyone knows if it is possible to create the following scenario using JavaScript:

1) A user enters some text into a text area then submits the text.

2) If the text contains illegal characters an alert is displayed informing the user that there are illegal characters in the text and that they must be edited.

3)When the user clicks 'OK' on the alert box, the first illegal character in the textarea is automatically highlighted so the user can easily spot where his/her error is.

Now I know how to set a string of illegal characters and get the alert box to display, so really 3) is the one I have the problem
with.

Any ideas?

Pete