Mega Code Archive

 
Categories / JavaScript Tutorial / HTML Tags
 

Link hostname

The hostname property represents the hostname portion of the link's URL. <html>     <head>     <title> Using the hostname property of the Link object</title>     </head>     <body>     <script language="JavaScript">     <!--     function showHostname(){          alert(document.links[0].hostname);     }     -->     </script>     Click the button to see the hostname for the URL     <form name="form1">     <a href="http://www.rntsoft.com">www.rntsoft.com</a>     <br><br>     <input type="button" name="host" value="Get Hostname Value" onClick='showHostname()'>     <br>     </form>     </body>     </html>