This article mainly introduces the implementation method of JavaScript simple number generator, involves related JavaScript techniques for form and string operations, and comes with the demo source code for readers to download and reference, for more information about how to implement the Javascript simple code generator, see the example in this article. We will share this with you for your reference. The details are as follows:
The running effect is as follows:
The Code is as follows:
Number GeneratorNumber GeneratorPrefix:Suffix:
Number of digits:
Continuous numberRandom character
Range:~
Filter characters:Multiple uses, separated by numbers
0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ contains the following characters:
Number of randomly generated instances:
Script var boNum = true; function fnNum () {document. getElementById ('pnum '). style. display = 'block'; document. getElementById ('ppwd '). style. display = 'none'; boNum = true;} function fnPwd () {document. getElementById ('pnum '). style. display = 'none'; document. getElementById ('ppwd '). style. display = 'block'; boNum = false;} function run () {var str = ''; var txtCount = parseInt (document. getElementById ('txtcou Nt '). value); var txtBegin = document. getElementById ('txtbegin '). value; var txtEnd = document. getElementById ('txtend '). value; var txtChar = document. getElementById ('txtchar '). value; var numCount = parseInt (document. getElementById ('numcount '). value); var numBegin = parseInt (document. getElementById ('numin in '). value); var numEnd = parseInt (document. getElementById ('numend '). value); var txtLimit = docu Ment. getElementById ('txtlimit '). value; var limit = txtLimit. split (','); if (txtLimit = '') {limit = [];} var count = 0; if (! BoNum) {var list = []; for (var I = 0; I
Click here to download the complete instance code.