91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

JS隨機密碼生成算法

發布時間:2020-10-17 13:46:49 來源:腳本之家 閱讀:179 作者:apple_2021 欄目:web開發

本文實例為大家分享了JS生成隨機密碼的具體代碼,供大家參考,具體內容如下

題目:

輸入一個正整數n,生成n個隨機密碼,其中包括數字,大小寫字母。

代碼:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
  div{
    width: 300px;
    height: 100px;
    background-color: lightblue;
    overflow: auto;
  }
  </style>
</head>
<body>
  <input type="text">
  <button>生成</button>
  <div class="end"></div>
  <script>
  var oTn = document.getElementsByTagName("input")[0];
  var oBtn = document.getElementsByTagName("button")[0];
  var oDiv = document.querySelector(".end");
  var password = ["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","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","0","1","2","3","4","5","6","7","8","9"
  ]; 
  function pass(length){
    var Str = "";
    for(var i = 0 ; i<length;i++){
      Str += password[Math.floor(Math.random()*password.length)];
    }
    return Str;
  }
  oBtn.onclick = function(){
    oDiv.innerHTML = pass(oTn.value);
  }
  </script>
</body>
</html>

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持億速云。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

原平市| 安康市| 兰坪| 手游| 邵阳市| 涿州市| 奉新县| 陇川县| 衡水市| 宾川县| 萨嘎县| 定州市| 鄂托克前旗| 郓城县| 溆浦县| 保山市| 易门县| 长顺县| 达孜县| 钟祥市| 沈丘县| 绩溪县| 大田县| 新晃| 威信县| 若尔盖县| 平阳县| 常熟市| 交城县| 邮箱| 邵东县| 通辽市| 都兰县| 保康县| 武川县| 阳山县| 巩留县| 阳谷县| 绥德县| 通化市| 昭平县|