Area port attribute

Definition and usage

port Attribute sets or returns href attribute value The port part.

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

Note:If the port is not specified in the URL (or if it is the default port of the protocol - for example, 80 or 443), some browsers will display 0 or not display it.

See also:

JavaScript Reference Manual:location.port attribute

Example

Example 2

Return the URL port of a specific area in the image mapping:

var x = document.getElementById("venus").port;

Try it yourself

Example 2

Change the URL port of a specific area in the image mapping:

document.getElementById("venus").port = "443";

Try it yourself

Syntax

Return the port attribute:

areaObject.port

Set port attribute:

areaObject.port = port

Attribute Value

Value Description
port Specifies the port number of the URL.

Technical Details

Return Value: A string value representing the port number of the URL.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support