JS弹窗公告,每天只弹一次

6个月前 / 0 评论 / 5197 阅读 / 正在检测是否收录...
<script>
function jb51tuitan() {
    if (getCookie('jb51popped') == '') {
        //要执行的代码或一些操作
        setCookie("jb51popped", "ok"); //写入cookies表示已经执行过了。
        setTimeout(function(){
            xtip.alert('最近微信支付有点问题,出错请选择支付宝支付');
        },9000)
    }
}
jb51tuitan()
function setCookie(name, value)
{
    var argv = setCookie.arguments;
    var argc = setCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    if (expires != null)
    {
        var LargeExpDate = new Date();
        LargeExpDate.setTime(LargeExpDate.getTime() + (expires * 1000 * 3600 * 24));
    }
    document.cookie = name + "=" + escape(value) + ((expires == null) ? "": ("; expires=" + LargeExpDate.toGMTString()));
}
function getCookie(Name)
{
    var search = Name + "="
    if (document.cookie.length > 0)
    {
        offset = document.cookie.indexOf(search)
        if (offset != -1)
        {
            offset += search.length
            end = document.cookie.indexOf(";", offset)
            if (end == -1) end = document.cookie.length
            return unescape(document.cookie.substring(offset, end))
        }
        else return ""
    }
}
</script>

评论

取消