August 1999
Intermediate to advanced
1488 pages
72h 53m
English
location.host
The host property of the Location object represents the host portion of the URL. This is composed of the hostname and the port number (if available).
In the following fictitious Web address:
http://www.mcp.com:80/foo?something#foobar
the host value would be the http://www.mcp.com:80 portion.
Listing 7.381 shows the how the host property is used.
<html>
<head>
<title> Using the hash property of the Location object</title>
</head>
<body>
<script language="JavaScript">
<!--Hide
// shows the host part of the URL
function show(){
document.form1.text1.value=document.location.host
}
// End ... |
Read now
Unlock full access