Syntax
document.links[num].hostname
The hostname property contains just the hostname that is specified in the URL.
This property is a read/write string.
<html>
<body>
<form name="question">
<input name="site"
type="radio"
checked
onClick="updateLinks('US')">US<br>
<input name="site"
type="radio"
onClick="updateLinks('EUROPE')">Europe
</form>
<MAP name="java2sMap">
<area name="car1"
coords="1,1,48,48"
href="http://www.java2s.com"
target="_top">
<area name="car2"
coords="51,1,99,49"
href="http://www.java2s.com"
target="_top">
</map>
<img src="http://www.java2s.com/style/logo.png" align="top" height="50" width="100" usemap="#java2sMap">
<hr>
<script language="JavaScript">
<!--
function updateLinks(site)
{
if(site=="US")
{
document.links[0].hostname="www.java2s.com";
document.links[1].hostname=document.links[0].hostname;
}
if(site=="EUROPE")
{
document.links[0].hostname="www.java2s.com";
document.links[1].hostname=document.links[0].hostname;
}
}
-->
</script>
</body>
</html>