资源描述:一个简洁的界面、一个文本字段和一个密码生成按钮。当单击“生成”按钮时,立即会生成以小写字母、大写字母、数字和特殊字符的随机组合字符串。这是一个简单的在线生成工具,你可以根据自身需求创建不同复杂程度的密码。
使用方法
console.log( 'neues Passwort mit folgendem Befehl:' );
console.log( 'new_password()' );
let c = 0;
function generate_password(){
arr = [
arra = [
'a', 'b', 'c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
],
arrA = [
'A', 'B', 'C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
],
arr0 = [
1,2,3,4,5,6,7,8,9,0
],
arrS = [
'!',"ยง","$","%","&","/","(",")","=","?","#","+","-","<",">"
]
];
let rando = Math.round( 8 + Math.random() * 8 );
let pw = [];
for( let i = 0; i < rando; i++ ){
let randoArr = Math.floor( Math.random() * 4 );
// console.log( 'randoArr', randoArr );
let randoZeich = Math.floor( Math.random() * arr[randoArr].length );
let zeichen = arr[randoArr][randoZeich];
pw.push( zeichen );
}
return pw;
}
function show_password( arr ){
let password = '';
for( let i = 0; i < arr.length; i++ ){
password += arr[i];
}
return password;
}
function get_text(){
let t = document.querySelector( '.pwtxt' );
return t;
}
function get_generate_btn(){
let t = document.querySelector( '.generator' );
return t;
}
get_generate_btn().addEventListener( 'click', function(){
c++;
if( c === 3 ){
t = get_text();
t.textContent = 'somethingNotRandom ;)';
t.classList.add( 'blue' );
}else{
t = get_text();
let p = show_password( generate_password() );
t.textContent = p;
t.classList.remove( 'blue' );
}
} );
站长提示:
1. 苦力吧素材官方QQ群:
950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励
2K币。
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服