this must be figured out!

admin

Administrator
Staff member
I want the user to enter a selection of text into a multiline text box. When the 'submit' button is pressed I want the selection of text to be searched for say the word 'cat' - and each instance of this word would be changed into the word 'lion. I can do that right? Because I need to...

Here's some code to help show what I'm trying to do:

<script>
function runfunction () {
var thestring = self.test.box.value; // this would capture the selection of text from the textbox and store it in the variable thestring.

//here's the code that's missing, what can I put here?

var theresult // this variable would be the selection of text after each instance of the word was changed.


self.test.box2.value = theresult // the new text would be displayed in a second multiline textbox

}
</script>


Thanks,
Stephen
 
Back
Top