{"id":5574,"date":"2024-09-09T16:01:05","date_gmt":"2024-09-09T08:01:05","guid":{"rendered":""},"modified":"2024-09-09T16:01:05","modified_gmt":"2024-09-09T08:01:05","slug":"js\u5bc6\u7801\u5f3a\u5ea6\u4f8b\u5b50\u5f3a\u4e2d\u5f31_\u5bc6\u7801\u5b89\u5168\u6d4b\u8bd5\u7f51\u7ad9","status":"publish","type":"post","link":"https:\/\/mushiming.com\/5574.html","title":{"rendered":"js\u5bc6\u7801\u5f3a\u5ea6\u4f8b\u5b50\u5f3a\u4e2d\u5f31_\u5bc6\u7801\u5b89\u5168\u6d4b\u8bd5\u7f51\u7ad9"},"content":{"rendered":"
\n
\n
<html>\n <head>\n  <title>JS\u5224\u65ad\u5bc6\u7801\u5f3a\u5ea6<\/title>\n  <script language=javascript>\n \/\/\u5224\u65ad\u8f93\u5165\u5bc6\u7801\u7684\u7c7b\u578b  \n function CharMode(iN) {\n  if (iN >= 48 && iN <= 57) \/\/\u6570\u5b57  \n   return 1;\n  if (iN >= 65 && iN <= 90) \/\/\u5927\u5199  \n   return 2;\n  if (iN >= 97 && iN <= 122) \/\/\u5c0f\u5199  \n   return 4;\n  else\n   return 8;\n }\n \/\/bitTotal\u51fd\u6570  \n \/\/\u8ba1\u7b97\u5bc6\u7801\u6a21\u5f0f  \n function bitTotal(num) {\n  modes = 0;\n  for (i = 0; i < 4; i++) {\n   if (num & 1)\n    modes++;\n   num >>>= 1;\n  }\n  return modes;\n }\n \/\/\u8fd4\u56de\u5f3a\u5ea6\u7ea7\u522b  \n function checkStrong(sPW) {\n  if (sPW.length <= 4)\n   return 0; \/\/\u5bc6\u7801\u592a\u77ed  \n  Modes = 0;\n  for (i = 0; i < sPW.length; i++) {\n   \/\/\u5bc6\u7801\u6a21\u5f0f  \n   Modes |= CharMode(sPW.charCodeAt(i));\n  }\n  return bitTotal(Modes);\n }\n \/\/\u663e\u793a\u989c\u8272  \n function pwStrength(pwd) {\n  O_color = \"#eeeeee\";\n  L_color = \"#FF0000\";\n  M_color = \"#FF9900\";\n  H_color = \"#33CC00\";\n  if (pwd == null || pwd == '') {\n   Lcolor = Mcolor = Hcolor = O_color;\n  } else {\n   S_level = checkStrong(pwd);\n   switch (S_level) {\n   case 0:\n    Lcolor = Mcolor = Hcolor = O_color;\n   case 1:\n    Lcolor = L_color;\n    Mcolor = Hcolor = O_color;\n    break;\n   case 2:\n    Lcolor = Mcolor = M_color;\n    Hcolor = O_color;\n    break;\n   default:\n    Lcolor = Mcolor = Hcolor = H_color;\n   }\n  }\n  document.getElementById(\"strength_L\").style.background = Lcolor;\n  document.getElementById(\"strength_M\").style.background = Mcolor;\n  document.getElementById(\"strength_H\").style.background = Hcolor;\n  return;\n }\n<\/script>\n <\/head>\n <body>\n  <form name=form1 action=\"\">\n   \u5bc6\u7801:\n   <input type=password size=8 onKeyUp=pwStrength(this.value); onBlur=pwStrength(this.value)>\n   <br>\n   \u5bc6\u7801\u5f3a\u5ea6:\n   <table width=\"210\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\"\n    bordercolor=\"#eeeeee\" height=\"22\" style='display: inline'>\n    <tr align=\"center\" bgcolor=\"#f5f5f5\">\n     <td width=\"33%\" id=\"strength_L\">\n      \u5f31\n     <\/td>\n     <td width=\"33%\" id=\"strength_M\">\n      \u4e2d\n     <\/td>\n     <td width=\"33%\" id=\"strength_H\">\n      \u5f3a\n     <\/td>\n    <\/tr>\n   <\/table>\n  <\/form>\n <\/body>\n<\/html><\/code><\/pre>\n<\/p><\/div>\n<\/div>\n

\u8f6c\u8f7d\u4e8e:https:\/\/blog.51cto.com\/yuke\/<\/p>\n","protected":false},"excerpt":{"rendered":"js\u5bc6\u7801\u5f3a\u5ea6\u4f8b\u5b50\u5f3a\u4e2d\u5f31_\u5bc6\u7801\u5b89\u5168\u6d4b\u8bd5\u7f51\u7ad9htmlheadtitleJS\u5224\u65ad\u5bc6\u7801\u5f3a\u5ea6\/titlescriptlanguage=javascript\/\/\u5224\u65ad\u8f93\u5165\u5bc6\u7801\u7684\u7c7b\u578bfu...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/5574"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=5574"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/5574\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=5574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=5574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=5574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}