WebEnh

.net7 mvc jquery bootstrap json 学习中 第一次学PHP,正在研究中。自学进行时... ... 我的博客 https://enhweb.github.io/ 不错的皮肤:darkgreentrip,iMetro_HD
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

juqery 实现 防止当前页面重复点击,以减轻服务器压力

Posted on 2016-11-05 00:25  WebEnh  阅读(577)  评论(0编辑  收藏  举报
    <script>
        //防止当前页面重复点击,以减轻服务器压力
        $(document).ready(function () {
            var current_url = location.pathname;
            $("a").each(function () {
                if (current_url == $(this).attr("href")) {
                    $(this).click(function () { return false; });
                    $(this).dblclick(function () { return false; });
                }
            });
            //alert(current_url)
        });
    </script>

juqery 实现 防止当前页面重复点击,以减轻服务器压力  演示地址:http://ade.chinacloudsites.cn/