//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>