代码如下:function GetCurrentDirectory() { var curHref = location.href; var curArray = locHref.split(“/”); delete curArray[curArray.length – 1]; var curdir = curArray.join(“/”); return curdir; }