| 
 <html>
 <head>
 <base id="myBase">
 <script language="JavaScript">
 function function1() {
 document.all.myBase.href= "http://www.java2s.com";
 }
 </script>
 </head>
 <body>
 
 <a id="myAnchor" href="/index.htm" hreflang="en">www.java2s.com site</a>
 
 <br><br>
 <button onclick="function1();">Change the base URL</button>
 <button onclick="alert(myAnchor.href);">Anchor</button>
 <button onclick="alert(location.href);">Location</button>
 <button onclick="alert(document.styleSheets(0).href);">style sheet</button>
 <button onclick="alert(myAnchor.hreflang);">Language</button>
 </body></html>
 
 
 
 
 |