hi all im trying to put together a random number generator. it's working fine but i want to be able to have a name field that when filled in it will be the start of the random number. here's what i have so fare. <script> var keylist="abcdefghijklmnopqrstuvwxyz123456789" var temp='' function generatepass(plength){ temp='' for (i=0;i<plength;i++) temp+=keylist.charAt(Math.floor(Math.random()*keylist.length)) return temp } function populateform(enterlength){ document.pgenerate.output.value=generatepass(enterlength) } </script> <form name="pgenerate"> <input name="output" type="text" onFocus="populateform(this.form.thelength.value)" size=18 readonly=""> <input type="hidden" name="thelength" size=3 value="10"> <input type="text" name="name"> </form>
Could you put an example of what you want to put on that field. I don't understand your sentence: "...with the start of the random number".
I'm not understanding what you want either. It looks to me like the code is producing a random string of length thelength.value. In the example above thelength.value = 10. So you want to prepend "10" to string? Or you want a control on form to input a number, and use that number to get a string of the length of that number?