Full version: jsB@nk » Snippet » Format Input script
URL: https://www.javascriptbank.com/format-input-script.html
Format the text case inside a form, reverse the text, or see the ASCII code behind the input. Cool!
Full version: jsB@nk » Snippet » Format Input script
URL: https://www.javascriptbank.com/format-input-script.html
<SCRIPT LANGUAGE="JavaScript">// Phillip Bryant ([email protected])<!-- Beginfunction reverse() {text = "";str = document.forms[0].elements[0].value=document.forms[0].elements[0].value;for (i = 0; i <= str.length; i++)text = str.substring(i, i+1) + text;document.forms[0].elements[0].value = document.forms[0].elements[0].value = text;}function lower() {document.forms[0].elements[0].value = document.forms[0].elements[0].value.toLowerCase()}function caps() {document.forms[0].elements[0].value = document.forms[0].elements[0].value.toUpperCase()}function whatIsThis() {document.forms[0].elements[0].value = escape(document.forms[0].elements[0].value)}function dontLikeThis() {document.forms[0].elements[0].value = unescape(document.forms[0].elements[0].value)}var t = new Array();t[0] = "Here is some text to use as an example. Click on reverse, uppercase, or lowercase.";function example() {for(var i = 0; i < 2; i++) {if(document.forms[0].elements[i].value) {document.forms[0].elements[0].value = document.forms[0].elements[0].value+unescape(t[0]); } }}var f = new Array();f[0] = "http%3A//www.JavaScriptBank.com";function exAscii() {for(var i = 0; i < 2; i++) {if(document.forms[0].elements[i].value) {document.forms[0].elements[0].value = document.forms[0].elements[0].value+unescape(f[0]); } }}// End --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form action="" method="post"><textarea rows=10 cols=40 wrap=soft></textarea><table border=0><center><tr><td><input type=button value="Example" onClick="example(this.form)"><input type=button value="Reverse" onClick="reverse()"><input type=button value="All Upper" onClick="caps()"><input type=button value="All Lower" onClick="lower()"></td></tr><tr><td><input type=button value="Ascii Example" onClick="exAscii()"><input type=button value="UnAscii" onClick="dontLikeThis()"><input type=button value="Ascii" onClick="whatIsThis()"><input type=button value="Clear It" onClick="reset()"></td></tr></table></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->