Javascript examples for DOM HTML Element:Base
The Base object represents an HTML <base> element.
You can access a <base> element by using getElementById():
<!DOCTYPE html> <html> <head> <base id="myBase" href="https://www.java2s.com/jsref/"> </head>//ww w.j a v a 2s . c om <body> <button onclick="myFunction()">get the URL of the base element</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myBase").href; document.getElementById("demo").innerHTML = x; } </script> </body> </html>