Link.hash

JavaScript 1.0+ Nav2+, Opera3+ Syntax

							link.hash

Description

The hash property represents a portion of the currently displayed URL.

Example

Listing 7.360 shows an example of how the hash property is used. When the button is clicked, the showHash() function displays the value of the hash property for the link.

Listing 7.360 Example of the hash Property
<html>
<head>
<title> Using the hash property of the Link object</title>
</head>
<body>

<script language="JavaScript">
<!-- Hide
// function shows the hash value of the link
function showHash(){
     document.form1.text1.value = document.links[0].hash;
}
// End Hide --->
</script>
							 Click the button to see the hash for the URL <form name="form1"> <a href=http://www.mcp.com:80/foo?something#foobar> ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.