Availability: |
| ||||||
Property/method value type: | String primitive | ||||||
JavaScript syntax: | - | myUrl.host | |||||
- | myUrl.host = aHost | ||||||
HTML syntax: | <A HREF="..."> <LINK HREF="..."> | ||||||
Argument list: | aHost | A new host name and optional port value |
This property yields the hostname and colon delimited port number of the HREF value in an <A> tag if there is one and an empty string if not.
You can redefine the host by assigning a new value to this property.
<HTML> <HEAD> </HEAD> <BODY> <A NAME="EXAMPLE" HREF="http://www.mydomain.com:8080/folder/file.html#abcdef">Click here</A><BR> <SCRIPT> document.write(document.links[0].host); </SCRIPT> </BODY> </HTML>
See also: | Anchor.hash, Anchor.host, URL, Url object, Url.href, Url.pathname, Url.port, Url.protocol, Url.search, Url.target |
Prev | Home | Next |
Url.hash | Up | Url.hostname |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |