Created
September 8, 2013 19:26
-
-
Save mixdev/6487670 to your computer and use it in GitHub Desktop.
Creates alpha numeric coupon codes with specified chars length. Not duplicates checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Coupon generator</title> | |
</head> | |
<body bgcolor="white" text="black"> | |
<script> | |
//var txt = 'aabcdefghijklmnopqrstuvwxyz0123456789'; | |
var txt = 'aabcdefghjkmnpqrstuvwxyz23456789';//Remove indistinguishable chars like o,0,i,l,1 | |
var ln=txt.length; | |
var codelen = 5; | |
var howmanycodes = 100; | |
var code=''; | |
for(j=0;j<howmanycodes;j++){ | |
for(i=0;i<codelen;i++) code += txt.charAt(Math.floor(Math.random() * ln) ); | |
code +="<br>"; | |
} | |
document.write(code.toUpperCase()); | |
</script></body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment