JavaScript学习笔记之获取当前目录的实现代码
时间:2021-07-01 10:21:17
帮助过:12人阅读
代码如下:
function GetCurrentDirectory()
{
var curHref = location.href;
var curArray = locHref.split("/");
delete curArray[curArray.length - 1];
var curdir = curArray.join("/");
return curdir;
}