You are here: irt.org | FAQ | JavaScript | Text | Q278 [ previous next ]
<SCRIPT LANGUAGE="JavaScript"><!-- function reverse() { var value = document.myForm.myText.value; for (var text = '',i=value.length-1;i>-1;i=i-1) text += value.charAt(i); document.myForm.myText.value = text; } //--></SCRIPT> <FORM NAME="myForm"> <INPUT TYPE="TEXT" NAME="myText"> <INPUT TYPE="BUTTON" onClick="reverse()" VALUE="Press Me"> </FORM>