構文
 
  location.pathname 
総合 インデックス
プロパティ
FirefoxIE

説明

  • 表示されているページのURIに関する情報のうち、 パス名部分の値を持つ。
  • 読み出し専用。

用例

ブラウザに表示しているページのURIのうち,パス名部分の値を取得し書き出す。
<script type="text/javascript">
<!--
document.write("URI:",location.href);
document.write("<br>");
document.write("パス名:",location.pathname);
//-->
</script>

この用例を実行する