var path=document.location.href.substring(0,document.location.href.lastIndexOf('/'));
JS: 获取当前页面URL
本文详细介绍了如何使用varpath表达式从当前URL中提取路径部分,并探讨了其在前端开发中的实际应用。
本文详细介绍了如何使用varpath表达式从当前URL中提取路径部分,并探讨了其在前端开发中的实际应用。
var path=document.location.href.substring(0,document.location.href.lastIndexOf('/'));

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