Location pathname 属性

定义和用法
pathname 属性是一个可读可写的字符串,可设置或返回当前 URL 的路径部分。
语法
location.pathname
浏览器支持
所有主要浏览器都支持 pathname 属性
实例
实例
返回当前URL的路径名:
<script>
document.write(location.pathname);
</script>
document.write(location.pathname);
</script>
以上实例输出结果:
