首页 / 知识

使用location.pathname属性返回URL的路径名

2023-04-11 13:08:00

使用location.pathname属性返回URL的路径名
Window Location Pathname
location.pathname 属性返回 URL 的路径名。
 
实例
返回当前 URL 的路径名:
 
<script>
 
document.write(location.pathname);
 
</script>
以上代码输出为:
 
/js/js-window-location.html

属性路径名路径输出返回实例

最新内容

相关内容

热门文章

推荐文章

标签云

猜你喜欢