JavaScript Program To Show The Current Hostmane And Port Of The Current URL


JavaScript Program To Show The Current Hostmane And Port Of The Current URL


<!DOCTYPE html>
<html>
<body>

<p id="demo">Click the button to return the hostname and port of the current URL.</p>

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

<script>
function myFunction()
{
var x = "Location Host: " + location.host;
var y = "Location Port: " + location.port;
document.getElementById("demo").innerHTML=x + y;
}
</script>

</body>
</html>




Comments

Popular posts from this blog

A Javascript Program To make (open new window and close that window) button in your web browser.