Sets or retrieves the port number associated with a URL.
dhtml语法
HTML | N/A |
---|
Scripting | object.port [ = sPort ] |
---|
DHTML可能的值
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.
DHTML代码范例
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="/hbcms/php/r.php?url=http%3a%2f%2fwww.microsoft.com" onclick="getport();" id=ohttp>http</a>
是否符合公共标准
There is no public standard that applies to this property.
Applies To