The port property represents the port number in the URL. This is not always present in all URLs.
<html>
<head>
<title> Using the port property of the Link object</title>
</head>
<body>
<script language="JavaScript">
<!--
function showport(){
alert(document.links[0].port);
}
-->
</script>
Click the button to see the port number for the URL
<form name="form1">
<a href=http://www.java2s.com>
http://www.java2s.com</a>
<br><br>
<input type="button" name="port" value="Get Port Number" onClick='showport()'>
<br>
</form>
</body>
</html>