You are here: irt.org | FAQ | JavaScript | Form | 6 | Q420 [ previous next ]
Try:
<script language="JavaScript"><!-- function vet(form) { var temp = '', input = form.input.value, length = form.input.value.length ; form.output.value = ''; for (var i=0; i<length; i++) { var letter = input.substring(i,i+1); var uppercase = letter.toUpperCase(); if (uppercase >= 'A' && uppercase <= 'Z' && temp.indexOf(uppercase) == -1) { temp += uppercase; form.output.value += letter; } } } //--></script> <form> <input type="text" name="input"> <input type="button" value="Validate" onClick="vet(this.form)"> <input type="text" name="output"> </form>