<html>
<head>
<title> Random Alpha numeric String Generator </title>
</head>
<script>
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 8;
var randomstringGenerator = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstringGenerator += chars.substring(rnum,rnum+1);
}
document.getElementById("randomfield").innerHTML = randomstringGenerator;
}
</script>
<body>
<center>
<h2 style="color: green"> Random Alpha Numeric String Generator </h2>
<h3> Click the button to generate a random alpha-numeric string </h3>
<form name="randform">
<input type="button" value="Generate" onClick="randomString();">
<br><br>
<h4 id="randomfield" style="color: green"> </h4>
</form>
</center>
</body>
</html>
<html>
<head>
<title>
Generate random alpha-numeric string using JavaScript
</title>
</head>
<body>
<center>
<h2 style="color:green;"> Random String Generator </h2>
<h3> Click the button to generate random alpha-numeric string </h3>
<button onClick="random_String_Generator()"> Generate String </button>
<p id="random_String" style="color: green;
font-size: 22px; font-weight: bold;"> </p>
<script>
var result = document.getElementById('random_String');
function random_String_Generator() {
result.innerHTML = Math.random().toString(36).slice(2);
}
</script>
</center>
</body>
</html>