JavaScript Reference/Javascript Properties/host
"host" Example
<html>
<body>
<script language="JavaScript">
function function1() {
alert(document.getElementById("myLink").host);
}
</script>
<a id="myLink" href="http://www.wbex.ru" target="_blank">wbex.ru Home Page</a>
<button onclick="function1();">Host Value</button>
<button onclick="alert(document.all.myLink.hostname);">Host Name</button>
</body>
</html>
"host" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <area> |
| |location |
+----------------+--------------------------------------------------------------+
"host" Syntax and Note
Note:
Read and write property.
Specifies the URL domain name and port number.
Syntax:
document.getElementById("elementID").host = value
document.all.elementID.host = value // IE only
location.host = value