代码教學

本工具[在线高强度随机密码生成器工具]使用JavaScript编写

STEP 1

STEP 2

核心代码如下

function appendHtml(name,url){
    var tmp_html     = $("#tmp").html().replaceAll("#NAME#",name).replaceAll("#URL#",url);
    $(".show-area").html(tmp_html);
}
$(function(){
    $(".generate-password").click(function(){
        for (var e = $("#pgLength").val(), a = "abcdefghijklmnopqrstuvwxyz", t = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", r = "0123456789", i = "!@#$%^&*()_+~`|}{[]:;?><,./-=", n = "", o = n; n.length < e; )
            entity1 = Math.ceil(a.length * Math.random() * Math.random()),
                entity2 = Math.ceil(r.length * Math.random() * Math.random()),
                entity3 = Math.ceil(i.length * Math.random() * Math.random()),
                entity4 = Math.ceil(t.length * Math.random() * Math.random()),
            $("#chkl").is(":checked") && n.length < e && (n += a.charAt(entity1)),
            $("#chku").is(":checked") && n.length < e && (n += t.charAt(entity4)),
            $("#chkn").is(":checked") && n.length < e && (n += r.charAt(entity2)),
            $("#chksc").is(":checked") && n.length < e && (n += i.charAt(entity3)),
            o == n && (rand = Math.floor(4 * Math.random()) + 1,
                1 == rand ? n += a.charAt(entity1) : 2 == rand ? n += t.charAt(entity4) : 3 == rand ? n += r.charAt(entity2) : 4 == rand && (n += i.charAt(entity3)),
                o = n);
        toolfk.report('generate-password',n);
        appendHtml("@lang('toolfk.lang_text_padd_rand_num')",n);
    });
});复制代码


值得一試的三個理由:

  1. 整合各種程序员开发中经常使用的开发测试工具。
  2. 简洁美观大气的网站页面
  3. 支持 在线格式化执行代码、APK在线反编译、在线高强度密码生成、在线网页截图 等二十多種工具服务