Anchor port Property - Change the port number of a link: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Anchor

Description

Anchor port Property - Change the port number of a link:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<button onclick="myFunction()">change the port number of the link above</button>

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

<script>
function myFunction() {//from  ww w.j  a v  a 2s.  c  om
    document.getElementById("myAnchor").port = "80";
    document.getElementById("demo").innerHTML = "The port number was changed to '80'.";
}
</script>

</body>
</html>

Related Tutorials