Link.host

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

							link.host

Description

The host property represents the host portion of the URL.

Example

Listing 7.361 shows how to use the host property. When the button is clicked, the showHost() function is called to show the value of the host property.

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

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

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.