Edit This Code:
<!DOCTYPE html>
<html>
<hea<!--d>
<base id="myBase" href="/jsref/">-->

</head
>

<body>

<a href="default.asp.html">Default</a>

<p>Click the button to change the value of the href attribute of the base element.</p>

<p>Try the link before and after you click the button.</p>

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

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

<script>
function myFunction() {
    document.getElementById("myBase").href = "/html/";
    document.getElementById("demo").innerHTML = "Base URL was changed from /jsref/ to /html/.";
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy