rcmb
asked on
Generate random 6-digit alpha-numeric code.
I need a javascript that will be envoked via an onclick
I need a random 6-Digit alpha-numeric (uppercase) id created when the user clicks the link provided. The id would then populate a form field.
So basically the user click the link and the form field gets populated with the 6-digit id.
Thanks,
Curtis
I need a random 6-Digit alpha-numeric (uppercase) id created when the user clicks the link provided. The id would then populate a form field.
So basically the user click the link and the form field gets populated with the 6-digit id.
Thanks,
Curtis
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Both worked equally as well but MrRobot was first. Thanks for your help and quick turnaround.
Curtis
Curtis
<script type="text/javascript"><!-
function getID(idLength)
{
var chars="0,1,2,3,4,5,6,7,8,9
chars=chars.split(",");
var min=0;
var max=chars.length-1;
var id="";
for(var i=0; i<idLength;i++)
{
id+=chars[ Math.floor(Math.random()*(
}
return id;
}
alert(getID(6));
//--></script>