jquery怎么获取获取当前文件所在目录?
答案:1 悬赏:0
解决时间 2021-02-21 13:16
- 提问者网友:富士山上尢
- 2021-02-20 14:08
jquery怎么获取获取当前文件所在目录?
最佳答案
- 二级知识专家网友:爱难随人意
- 2021-02-20 15:07
jquery 取得文件根目录
jquery 取得文件根目录
function getRootPath() {
//获得根目录
var strFullPath = window.document.location.href;
var strPath = window.document.location.pathname;
var pos = strFullPath.indexOf(strPath);
var prePath = strFullPath.substring(0, pos);
var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
return (prePath + postPath);
}
jquery 取得文件根目录
function getRootPath() {
//获得根目录
var strFullPath = window.document.location.href;
var strPath = window.document.location.pathname;
var pos = strFullPath.indexOf(strPath);
var prePath = strFullPath.substring(0, pos);
var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
return (prePath + postPath);
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
• 手机登qq时,显示手机磁盘不足,清理后重新登 |
• 刺客的套装怎么选啊? |