Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <base id="myBase" href="/jsref/"> </head> <body> <a href="default.asp">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/index.html"; document.getElementById("demo").innerHTML = "Base URL was changed from /jsref/ to /html/."; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_base_href2 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:31:19 GMT --> </html>
Result:
Try it Yourself - © w3schools.com