HTML DOM hash Property
Definition and Usage
The hash property sets or returns the URL from
the hash sign (#).
The hash property specifies an anchor name in a URL.
Syntax
Example
Assume that the current URL is: http://example.com/test.htm#part2:
<html>
<body>
<script type="text/javascript">
document.write(location.hash);
</script>
</body>
</html>
|
Output:
Try-It-Yourself Demos
Use the hash
property of the location object
Anchors array
- This example opens two windows. The first window contains four buttons and the
second window defines four anchors from 0 to 3. When a button is clicked in the
first window, the onclick event handler goes to the specified anchor in the
second window.
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|