JavaScript Random Letter Generator

 

This simple script, will show you how to generate a random letter in JavaScript.

If you decide you want to use or alter the script to suit your needs, please give your support and leave a link to this site, thanks.

Try it out! Every time the page is reloaded or has a refresh, a new random letter is generated.

 

Example

 

(Ver 1.0) Random letter is:

(Ver 1.1) Random letter is:

 

Script Source (within the BODY section)


(Version 1.0)

 

<script type="text/javascript">
// Script by www.wizzardweb.co.uk
<!-- begin
var let1 = String.fromCharCode(97 + Math.round(Math.random() * 25));
var let2 = String.fromCharCode(65 + Math.round(Math.random() * 25));
var let3 = String.fromCharCode(97 + Math.round(Math.random() * 25));
var let4 = String.fromCharCode(65 + Math.round(Math.random() * 25));
var let5 = String.fromCharCode(65 + Math.round(Math.random() * 25));
var let6 = String.fromCharCode(97 + Math.round(Math.random() * 25));
document.write(let1);
document.write(let2);
document.write(let3);
document.write(let4);
document.write(let5);
document.write(let6);
//--> end

</script>


(Version 1.1) 


<script type="text/javascript">
// Script by www.wizzardweb.co.uk
<!-- begin
var char = new Array();
char[0] = String.fromCharCode(97 + Math.round(Math.random() * 25));
char[1] = String.fromCharCode(65 + Math.round(Math.random() * 25));
char[2] = String.fromCharCode(97 + Math.round(Math.random() * 25));
char[3] = String.fromCharCode(65 + Math.round(Math.random() * 25));
char[4] = String.fromCharCode(65 + Math.round(Math.random() * 25));
char[5] = String.fromCharCode(97 + Math.round(Math.random() * 25));

for (i=0;i<char.length;i++)
{
document.write(char[i]);
}
//--> end
</script>


Please let me know if this script was helpful to you.

[rating]