Home | Top | Web development | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


port Property

Sets or retrieves the port number associated with a URL.

Syntax

HTML Scripting
N/A
object.port [ = sPort ]

Possible Values

sPort String that specifies or receives the port number associated with the URL. See remarks.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties .

Remarks

The port will resolve based on the default port for the protocol set in the HREF attribute: 21 for FTP, 80 for HTTP, and so forth.

Proprietary protocols that do not require a port return 0 or an empty string.

location.port returns an empty string when read in a page reached by the http protocol.

Example

This example function returns the port property of two a elements.

<SCRIPT>
function getPort()
{ alert ("FTP: " + oFtp. port + "\n" + "HTTP: " + oHttp. port ); }
</SCRIPT>
<A HREF="ftp://www.microsoft.com" onclick="getPort();" ID=oFtp>ftp</A>
<A href="/" onclick="getPort();" ID=oHttp>http</A>

Standards Information

There is no public standard that applies to this property.

Applies To

Platform Version
Win16:
Win32:
Windows CE:
Unix:
Mac:
 
A , AREA , location
Home | Top | Web development | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.