1.在静态页面中
<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) {//这里要用while
if ($('div')[index].attributes['type'] != undefined) {
$('div')[index].innerHTML += $.webpages($('div')[index].attributes);
}
index++;
}
})
</script>
<body>
<div id="breadnav" type="GeBingName">
//这里将是动态页面中的内容
</div>
</body>
2. jquery。cookie.js文件中的函数
jQuery.webpages = function(list) {
var text;
try {
if (list["type"] != undefined) {
var type = list["type"].value;
switch (type) {
case "login":
$.ajax({
type: "POST",
url: "/user/login",
async: false,
data: "value=" + window.location,
success: function(msg) {
text = msg;
}
});
break;。。。。。。。。