location.href 获得当前页面url地址(字符串)
var arr = location.href.split('/');
var fileName = a[a.length - 1]; //例如index.html
本文介绍了一种使用JavaScript获取当前页面完整URL的方法,通过location.href属性并结合字符串的split方法,可以解析出URL中的文件名。
location.href 获得当前页面url地址(字符串)
var arr = location.href.split('/');
var fileName = a[a.length - 1]; //例如index.html
444
3505
2170

被折叠的 条评论
为什么被折叠?