hashプロパティ
locationオブジェクトのhashプロパティはURLで指定した#以降の文字列を返します。
書式 | location.hash | |
---|---|---|
対応 | ||
値 | #以降の文字列 |
使用例 | URLで指定した#以降の文字列を表示。 |
---|
<a id="Anchor" href="/test/docs/Location.href#hashtest">hashtest</a>
<script>
var anchor = document.getElementById("Anchor");
write(anchor.hash); //#hashtest
</script>