THE WORLD'S LARGEST WEB DEVELOPER SITE

Area port Property

❮ Area Object

Example

Return the port number of the URL for a specific area in an image-map:

var x = document.getElementById("venus").port;
Try it Yourself »

Definition and Usage

The port property sets or returns the port part of the href attribute value.

The href attribute specifies the destination of a link in an area.

Note: If the port number is not specified in the URL (or if it is the scheme's default port - like 80, or 443), some browsers will display 0 or nothing.


Browser Support

Property
port Yes Yes Yes Yes Yes

Syntax

Return the port property:

areaObject.port

Set the port property:

areaObject.port = port

Property Values

Value Description
port Specifies the port number of a URL

Technical Details

Return Value: A String, representing the port number of the URL

More Examples

Example

Change the port number of the URL for a specific area in an image-map:

document.getElementById("venus").port = "443";
Try it Yourself »

Related Pages

JavaScript reference: location.port Property


❮ Area Object