zoukankan      html  css  js  c++  java
  • jquery.cookie.js type

    //jquery.cookie.js
    
    jQuery.webpages = function(obj) {
        var text;
        var list = obj.attributes;
        try {
            if (list["type"] != undefined) {
                var type = list["type"].value;
    
                switch (type) {
                    case "login":
                        var msg;
                        var url = window.location;
                        if (document.referrer != undefined) {
                            url = document.referrer;
                        }
                        $.ajax({
                            type: "POST",
                            url: "/user/login",
                            async: true,
                            data: "value=" + url,
                            success: function(msg) {
                                obj.innerHTML = msg;
                            }
                        });
                                  break;
                }
            }
        }
        catch (e) { }
        return text;
    }

    下面是对cookie的引用

    //页面中

      <script type="text/javascript" language="javascript" src="/Scripts/jquery.cookie.js"></script>

        <script type="text/javascript" language="javascript">
            $(document).ready(function() {
                var index = 0;
                while (index < $('div').length) {
                    if ($('div')[index].attributes['type'] != undefined) {
                        $.webpages($('div')[index]);
                    }
                    index++;
                }
            })
        </script>

    <div class="notice_right" type="login">
            </div>

  • 相关阅读:
    完全二分图生成树计数
    [luogu 1880]石子合并
    [vijos 1770]大内密探
    母函数入门笔记(施工中…
    【补】20160816训练记录
    20160819训练记录
    20160817训练记录
    POJ 2228 naptime
    POJ 3585 Accumulation Degree
    POJ 2182 Lost Cows
  • 原文地址:https://www.cnblogs.com/nanxiaoxiang/p/2725556.html
Copyright © 2011-2022 走看看