Does anyone know how I might add a function to this script that continually adds one space before and after the entire query (not in between every word though)?
Example:
If I type in the textarea: "hello there", before the Change button is clicked the string is " hello there ", and then it is parsed as such?
[HTML]<html>
<head>
<script type = "text/javascript">
function replaceChars() {
var temp = document.subform.text.value;
temp = temp.replace(/hello there/gi, "goodbye there");
temp = temp.replace (/this/gi, "that");
temp = temp.replace (/today/gi, "tomorrow");
document.subform.text.value = temp;
}
</script>
</head>
<body>
<form name="subform">
<textarea rows="8" name="text" cols="31" value=""></textarea>
<br>
<input type=button name=action value="Change" onClick="replaceChars(document.subform.text.value) ;">
</form>
</body>
</html>
[/HTML]
Thanks!