3分钟
Window Location Pathname
location.pathname 属性返回 URL 的路径名。
返回当前 URL 的路径名:
<script>
document.write(location.pathname);
</script> 以上代码输出为:
document.write(location.pathname); location.pathname 属性返回 URL 的路径名。
返回当前 URL 的路径名:
<script>
document.write(location.pathname);
</script> 以上代码输出为:
document.write(location.pathname); Copyright © 2013-2025 Tencent Cloud.All Rights Reserved. 腾讯云 版权所有
学员评价