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.
Learn XML with <oXygen/> XML Editor - Free Trial!
 |
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|