最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery or javascript password generator with at least a capital and a number - Stack Overflow

programmeradmin2浏览0评论

How would one need to modify one of these examples, to have at least a capital and a nubmer inside the password?

jQuery password generator

.html

.php

or any other example :)

How would one need to modify one of these examples, to have at least a capital and a nubmer inside the password?

jQuery password generator

http://javascript.internet./passwords/password-generator.html

http://www.blazonry./javascript/password.php

or any other example :)

Share edited May 23, 2017 at 11:45 CommunityBot 11 silver badge asked Apr 30, 2011 at 8:26 giorgio79giorgio79 4,21910 gold badges63 silver badges92 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 13

off the top of my head:

function generatePassword(len){
    var pwd = [], cc = String.fromCharCode, R = Math.random, rnd, i;
    pwd.push(cc(48+(0|R()*10))); // push a number
    pwd.push(cc(65+(0|R()*26))); // push an upper case letter

    for(i=2; i<len; i++){
       rnd = 0|R()*62; // generate upper OR lower OR number
       pwd.push(cc(48+rnd+(rnd>9?7:0)+(rnd>35?6:0)));
    }

    // shuffle letters in password
    return pwd.sort(function(){ return R() - .5; }).join('');
}
发布评论

评论列表(0)

  1. 暂无评论