Location pathname 屬性

定義和用法
pathname 屬性是一個(gè)可讀可寫的字符串,可設(shè)置或返回當(dāng)前 URL 的路徑部分。
語(yǔ)法
location.pathname
瀏覽器支持
所有主要瀏覽器都支持 pathname 屬性
實(shí)例
實(shí)例
返回當(dāng)前URL的路徑名:
<script>
document.write(location.pathname);
</script>
document.write(location.pathname);
</script>
以上實(shí)例輸出結(jié)果:
document.write(location.pathname);
嘗試一下 ?

更多建議: