Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Need help with text area


Message #1 by "Chris Cote" <cotec@s...> on Mon, 28 Jan 2002 16:27:37
I know this question is in other places, but I have yet to get an answer.  
I am hoping that someone here will be able to help me with this problem.  
I have a text area that I want people to enter text into.  I then would 
like to be able to have the user highlight some text and click a button.  
By clicking the button, the text they have highlighted will have some 
extra characters added.  As an example, let's say we have a button that 
makes a singular noun into plural by adding either "es" or "s" at the end 
of the string.  
  I have seen some code to be able to retrieve the selection, which I give 
below.  However, I can't figure out how to change the text in the 
selection.
  Again, I don't want to do anything with the HTML code, I just want to 
change what is visible in the text box.
Please help if you can.
   In the Beginning Javascript book, Appendix E, the TextRange Object 
appears to be what I want, but I'm not sure how to manipulate the string 
since there are no descriptions of the methods.

Chris

Here's the code I found for getting selections:

  Return to Index