var js = document.scripts;
js = js[js.length - 1].src.substring(0, js[js.length - 1].src.lastIndexOf("/") + 1);
如路径为 http://localhost:24395/ABC/XX/a.js
结果会得到 http://localhost:24395/ABC/XX/
dm3344 博主文章分类:JavaScript ©著作权
var js = document.scripts;
js = js[js.length - 1].src.substring(0, js[js.length - 1].src.lastIndexOf("/") + 1);
如路径为 http://localhost:24395/ABC/XX/a.js
结果会得到 http://localhost:24395/ABC/XX/
一、Google,FF浏览器获取当前js文件的路径 document.currentScript.src 二、比较兼容的获取方式(推荐) 如路径为 http://localhost:24395/ABC/XX/a.js 结果会得到 http://localhost:24395/ABC/XX/ 更多:
然后,右键单击多次循环,在弹出的对话框中,将
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M