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