关于导航菜单的问题?各位高手请多多帮忙啊
我是一名初学菜鸟,今日看到一个网站的导航菜单比较有特色(http://www.gdga.),而且还能结合cookie 记忆菜单状态,但我把其静态网页保存下来有待详细学习时,静态首页总是弹出错误提示“null:[object error] ”“error:undefined”代码如下:
// JavaScript Document
$(document).ready(function(){
$.ajaxSetup({
cache: true
});
/* 主菜单 */
var navCookie = getCookie('navFix');
if(navCookie){
$('#btnOpenNav').addClass('current').attr('title','缩放');
$('.mainNav').stop().css('height','110px');
$('.mainNav').unbind();
}else{
$('#btnOpenNav').removeClass('current').attr('title','固定');
$('.mainNav').stop().css('height','40px');
navAnimate();
}
$('#btnOpenNav').toggle(
function(){
$(this).addClass('current').attr('title','缩放');
setCookie('navFix', true, 5);
$('.mainNav').stop().css('height','110px');
$('.mainNav').unbind();
},
function(){
$(this).removeClass('current').attr('title','固定');
deleteCookie('navFix');
//$('.mainNav').stop().css('height','40px');
navAnimate();
});
$('.mainNav ul li').hover(
function(){
//alert($(this).html());
$(this).find('p').addClass('current');
},
function(){
$(this).find('p').removeClass('current');
});
function navAnimate(){
$('.mainNav').hover(
function(){
$(this).stop().animate({height: '110px'}, "fast");
},
function(){
$(this).stop().animate({height: '40px'}, "fast");
});
}
/* cookies */
function getCookie(Name) {
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
//return null
}
function setCookie(name, value, days) {
var expireDate = new Date()
//set "expstring" to either future or past date, to set or delete cookie, respectively
var expstring=(typeof days!="undefined")? expireDate.setDate(expireDate.getDate()+parseInt(days)) : expireDate.setDate(expireDate.getDate()-5)
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}
function deleteCookie(name){
var expires = new Date();
expires.setTime(expires.getTime() - 1);
setCookie(name, '', expires)
//setCookie(name, "moot")
}
/*网站地图fucntion*/
function getparentid(ni){
var pid = '';
$.ajax({
url: '/siteNav.xml',
type: 'GET',
dataType: 'xml',
async: false,
cache: true,
//cache: false,
global: false ,
success: function(xml){
//alert(xml);
pid = $(xml).find('nav > menu[id="'+ni+'"]').attr('parentid');
},
error: function(XMLHttpRequest, textStatus, errorThrown){
alert(textStatus+":"+errorThrown);
}
});
return pid;
}
function siteNavXml(ni){
$.ajax({
url: '/siteNav.xml',
type: 'GET',
dataType: 'xml',
//cache: false,
global: false ,
success: function(xml){
//alert(xml);
if($(xml).find('nav > menu[parentid="'+ni+'"]').size() != 0){
$('#siteNavCon').empty();
$(xml).find('nav > menu[parentid="'+ni+'"]').each(function(i){
var txt = '';
txt += '<a href="';
txt += $(this).find('link').text();
if($(this).find('link').text() == 'javascript:;'){
txt += '" class="siteNavFile';
}else{
txt += '" class="siteNavLink" target="_blank';
}
txt += '" title="';
txt += $(this).find('title').text();
txt += '" id="'
txt += $(this).attr('id');
//txt += '" parentid="'
//txt += $(this).attr('parentid');
txt += '" >';
txt += $(this).find('name').text();
txt += '</a><br />';
$('#siteNavCon').append(txt);
});
}
},
error: function(XMLHttpRequest, textStatus, errorThrown){
alert(textStatus+":"+errorThrown);
}
});
}
});
因为本人实在是看不懂了,恳请各位能够指点迷津啊,谢谢了