//初始化菜单 function getHeaderMenuData(){ $.ajax({ type : 'post', url : rootPath + '/index/getHeaderMenu', beforeSend: function () { showLoad(); }, success : function(data) { initHeaderMenu(data); }, error : function(XMLHttpRequest, textStatus, errorThrown) { if(errorThrown == "Forbidden" || XMLHttpRequest.status == "403" || XMLHttpRequest.status == "404"){ layer.alert(ForbiddenMsg,{icon: 7},function(){ window.location.href = rootPath; }); }else{ layer.alert(errorThrown,{icon: 7},function(){ window.location.href = rootPath; }); } }, complete: function(XMLHttpRequest, textStatus) { closeLoad(); } }); } //初始化同步菜单 function initHeaderMenu(data){ //组织一级菜单开始 var menuTree = getTree(data, "-1"); var inner = ""; var targetBlank = ""; for(var i=0;i"+ ""+ menuTree[i]["F_NAME"]+""; } document.getElementById("firstTopMenu").innerHTML = inner; //组织一级菜单结束 //组织二级菜单开始 var thirdInner = ""; var secondInner = ""; for(var i=0;i 0){ if(menuTree[i]["child"][0]["child"].length > 0){ thirdInner += ""; } } document.getElementById("showdiv").innerHTML = secondInner; document.getElementById("showdiv").innerHTML += thirdInner; setColor(); } function showDetialMenu(id){ var showDiv = $("#showdiv"); showDiv.hide(); showDiv.find("div.wrap").hide(); if(showDiv.find("#"+id).length > 0){ showDiv.show(); showDiv.find("#"+id).slideDown("slow"); } } function hideDetialMenu(){ var showDiv = $("#showdiv"); showDiv.hide(); } function setColor(){ var pathname = window.location.pathname; $('#firstTopMenu li').each(function () { if($(this).attr("id") == pathname){ $(this).addClass("cur"); } }) }