www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
Properties
 port Property
port Property

Sets or retrieves the port number associated with a URL.

Syntax

HTMLN/A
Scripting[ sPort = ] object.port

Possible Values

sPortString 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"  ID=oFtp>ftp</A>
<A HREF="http://www.microsoft.com"  ID=oHttp>http</A>

Standards Information

There is no public standard that applies to this property.

Applies To

A, AREA, location
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG