javascript - Find and Replace for Textarea Problems -
i'm trying add cool little find , replace system. wan't make highlights found items(which code doesn't right now). wan't add find next button (right replaces found).
my javascript is:
function replacecharacters() { var inchar = document.form1.inc.value; var outchar = document.form1.outc.value; var newstring = document.form1.cool.value.split(inchar); newstring = newstring.join(outchar); document.form1.cool.value = newstring; }
and html is:
<form name="form1" method="post" action=""> <textarea class="code" name="cool" type="text" id="cool"> little text testing. </textarea> <br> replace instances of: <input name="inc" type="text" id="inc" value="tr" size="4"> with: <input name="outc" type="text" id="outc" value="w" size="4"> <br> <input type="button" name="capitalize" value="replace now" onclick="replacecharacters();"> </form>
here example.
Comments
Post a Comment