JS 姓氏,区域,消息组成的随机内容定时随机展示

var surname_g = "\u8D75\u94B1\u5B59\u674E\u5468\u5434\u90D1\u738B\u51AF\u9648\u891A\u536B\u848B\u6C88\u97E9\u6768\u6731\u79E6\u5C24\u8BB8\u4F55\u5415\u65BD\u5F20\u5B54\u66F9\u4E25\u534E\u91D1\u9B4F\u9676\u59DC\u621A\u8C22\u90B9\u55BB\u67CF\u6C34\u7AA6\u7AE0\u4E91\u82CF\u6F58\u845B\u595A\u8303\u5F6D\u90CE\u9C81\u97E6\u660C\u9A6C\u82D7\u51E4\u82B1\u65B9\u4FDE\u4EFB\u8881\u67F3\u9146\u9C8D\u53F2\u5510\u8D39\u5EC9\u5C91\u859B\u96F7\u8D3A\u502A\u6C64\u6ED5\u6BB7\u7F57\u6BD5\u90DD\u90AC\u5B89\u5E38\u4E50\u4E8E\u65F6\u5085";
var region_h = ["\u6CB3\u5317", "\u5C71\u897F", "\u5409\u6797", "\u8FBD\u5B81", "\u9655\u897F", "\u7518\u8083", "\u9752\u6D77", "\u5C71\u4E1C", "\u6CB3\u5357", "\u6C5F\u82CF", "\u6D59\u6C5F", "\u5B89\u5FBD", "\u6C5F\u897F", "\u798F\u5EFA", "\u6E56\u5317", "\u6E56\u5357", "\u5E7F\u4E1C", "\u6D77\u5357", "\u56DB\u5DDD", "\u4E91\u5357", "\u8D35\u5DDE", "\u5317\u4EAC", "\u4E0A\u6D77", "\u5929\u6D25", "\u91CD\u5E86"];
var sex_i = ["\u5148\u751F", "\u5973\u58EB"];
var dialog_j = "<div id='hdf_plug1' style='z-index:2147483646;display: none;margin: 0;padding: 0; width: 80%;height: 40px;border-radius:20px;background: rgba(209,209,209,0.91);position: fixed;bottom:15%;left: 10%;'>" + "<p style='margin: 0 10px;padding: 0; line-height: 40px;text-align: center;font-size: 14px' id='hdf_plug1_text'></p>" + "</div>";
        
$("body").append(dialog_j);
$(document).ready(function() {
    autoShow();
});
var k, e = 5;
function autoHide() {
    if (k) {
        clearTimeout(k)
    }
    k = setTimeout(function() {
        $("#hdf_plug1").hide(100);
        autoShow()
    }, 3000)
}
function autoShow() {
    if (k) {
        clearTimeout(k)
    }
    k = setTimeout(function() {
        var surname_a     = Math.floor(Math.random() * surname_g.length);
        var region_b     = Math.floor(Math.random() * region_h.length);
        var sex_c         = sex_i[Math.floor(Math.random() * sex_i.length)];
        $("#hdf_plug1_text").text("\u6D88\u606F\u003A\u6765\u81EA" + region_h[region_b] + "\u7684" + surname_g[surname_a] + sex_c + "\u521A\u6DFB\u52A0\u4E86\u5FAE\u4FE1");
        $("#hdf_plug1").show(100);
        autoHide()
    }, e * 1000)
}

 

posted @ 2020-05-20 09:32  心无引擎,眼无流派  阅读(506)  评论(0编辑  收藏  举报