Area portProperty
Area Object
Definition and Usage
The port property sets or returns the port portion of the href attribute value.
Syntax
areaObject.port=port
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the port property
Tips and Notes
Note:If the port portion is not specified in the URL, or is 80 (the default), some browsers will display 0 or nothing.
Example
Example
The following example returns the port in the "Venus" area:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial(example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>The port of the "Venus" area:
<script>
document.write(document.getElementById('venus').port);
</script>
</p>
<p><b>Note:</b> If the URL does not specify a port portion, or it is 80 (default), some browsers will display 0 or nothing.</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial(example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>The port of the "Venus" area:
<script>
document.write(document.getElementById('venus').port);
</script>
</p>
<p><b>Note:</b> If the URL does not specify a port portion, or it is 80 (default), some browsers will display 0 or nothing.</p>
</body>
</html>
The output of the above example:
The port of the "Venus" area: 80
Try it yourself »
Area Object Other Extensions