<!DOCTYPE html>
<html>
<body>
<p><a id="myAnchor" href="../../www.example.com:80/index.html">Example link</a></p>
<p>Click the button to change the hostname and port number of the link above.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myAnchor").host = "www.w3ii.com:80";
document.getElementById("demo").innerHTML = "The link above now goes to 'www.w3ii.com:80'.";
}
</script>
</body>
</html>