Link.href

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

							link.href

Description

The href property of the Link object represents the whole URL for the link.

Example

Listing 7.363 shows how to use the href property. When the button is clicked, the showhref() function displays the value of the href property of the link.

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

<script language="JavaScript">
<!-- Hide

// displays the value of the href property in the text box.
function showhref(){
     document.form1.text1.value = document.links[0].href;
}
// End Hide --->
</script>
							 Click the button to see the href property for the URL <form name="form1"> ...

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.