<!DOCTYPE html>
<html>
<body>

<p><a id="myAnchor" target="_blank" href="../../www.example.com:443/test.htm#part2">Example link</a></p>

<p>Click the button to change the hostname and port number of the link above.</p>

<p><b>Tip:</b> Open the link and look in the address bar before and after you have clicked the "Try it" button (Note: these links does not exist, this is just an example).</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myAnchor").host = "www.somenewexamplepage.com:344";
    document.getElementById("demo").innerHTML = "The hostname and port number of the Example link was changed.";
}
</script>

</body>
</html>