1<script language="javascript" type="text/javascript">
2function randomString() {
3 var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
4 var string_length = 8;
5 var randomstring = '';
6 for (var i=0; i<string_length; i++) {
7 var rnum = Math.floor(Math.random() * chars.length);
8 randomstring += chars.substring(rnum,rnum+1);
9 }
10 document.randform.randomfield.value = randomstring;
11}
12</script>
1<form name="randform">
2<input type="button" value="Create Random String" onClick="randomString();">
3<input type="text" name="randomfield" value="">
4</form>