function GetUrlRelativePath() { var url = document.location.toString(); var arrUrl = url.split("//"); var start = arrUrl[1].indexOf("/"); var relUrl = arrUrl[1].substring(start); //stop鐪佺暐锛屾埅鍙栦粠start寮€濮嬪埌缁撳熬鐨勬墍鏈夊瓧绗� if(relUrl.indexOf("?") != -1){ relUrl = relUrl.split("?")[0]; } return relUrl; } $("#main_nav a[href='"+GetUrlRelativePath()+"']").addClass('on'); $(document).ready(function(){ $(".suspend").mouseover(function() { $(this).stop(); $(this).animate({width: 160}, 400); }) $(".suspend").mouseout(function() { $(this).stop(); $(this).animate({width: 40}, 400); }); });