Availability: |
| ||||||
Property/method value type: | String primitive | ||||||
JavaScript syntax: | - | myUrl.port | |||||
- | myUrl.port = aPortNumber | ||||||
HTML syntax: | <A HREF="..."> <LINK HREF="..."> | ||||||
Argument list: | aPortNumber | A numeric value to be used as a port number |
This property yields the port number value of the HREF attribute in an <A> tag if there is one and an empty string if not.
You can assign a value to this property as if it was an LValue.
Do not include the delimiting colon when you assign a value to this property.
Make sure you assign a numeric value. Non-numeric values will be rejected. This is to avoid the possibility of a completely invalid port number being used.
<HTML> <HEAD> </HEAD> <BODY> <A NAME="EXAMPLE" HREF="http://www.mydomain.com:8080/folder/file.html#abcdef">Click here</A><BR> <SCRIPT> // In testing, this did not work in Opera 5.0 document.write(document.links[0].port); </SCRIPT> </BODY> </HTML>
See also: | Anchor.hash, Anchor.port, URL, Url object, Url.hash, Url.host, Url.hostname, Url.href, Url.pathname, Url.protocol, Url.search, Url.target |
Prev | Home | Next |
Url.pathname | Up | Url.protocol |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |