Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (65 sloc) 1.53 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JavaScript Random String Generator</title>
<style>
body {
font: 12px Arial, sans-serif;
color: #333;
}
.info {
margin-bottom: 24px;
}
</style>
</head>
<body>
<h1>Random String Generator</h1>
<p class="info">The following strings are generated to a random length using a max limit of 30 characters.</p>
<section class="block">
<h2>Numeric String</h2>
<p id="str_numeric"></p>
</section>
<section class="block">
<h2>Alphabetic String - Lowercase</h2>
<p id="str_alphalc"></p>
</section>
<section class="block">
<h2>Alphabetic String - Uppercase</h2>
<p id="str_alphauc"></p>
</section>
<section class="block">
<h2>Alphabetic String</h2>
<p id="str_alpha"></p>
</section>
<section class="block">
<h2>Alphanumeric String</h2>
<p id="str_alphanum"></p>
</section>
<section class="block">
<h2>Special Characters</h2>
<p id="str_special"></p>
</section>
<section class="block">
<h2>All Characters</h2>
<p id="str_all"></p>
</section>
<script src="random_string_generator.js"></script>
<script>
window.onload = function(){
var els = {
'str_numeric' : 'num',
'str_alphalc' : 'alphalc',
'str_alphauc' : 'alphauc',
'str_alpha' : 'alpha',
'str_alphanum': 'alphanum',
'str_special' : 'special',
'str_all' : 'all'
};
for (var prop in els){
document.getElementById(prop).appendChild( document.createTextNode(generateRandomString(els[prop], 30)) );
}
};
</script>
</body>
</html>