bryanfl100
Technical User
I have the current code for a text field that automatically replaces an "&" for "and" if someone types it in the field. Is there a way to add additional characters such as "@" for "at":
The current code is:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function replaceChars(entry) {
out = "&"; // replace this
add = "and"; // with this
temp = "" + entry; // temporary holder
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.group.SpecialInstructions.value = temp;
}
// End -->
</script>
<form name="group" method="POST" action="<textarea name="SpecialInstructions" rows="3" cols="49" onBlur="replaceChars(this.value);">Number of computers: </textarea></form>
The current code is:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function replaceChars(entry) {
out = "&"; // replace this
add = "and"; // with this
temp = "" + entry; // temporary holder
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.group.SpecialInstructions.value = temp;
}
// End -->
</script>
<form name="group" method="POST" action="<textarea name="SpecialInstructions" rows="3" cols="49" onBlur="replaceChars(this.value);">Number of computers: </textarea></form>