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