Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<title>UK Map Example</title>
<style type="text/css" media="screen,projection">
#locations {
width: 9em;
float: right;
}
#map {
width:297px;
height:388px;
background-Image:url(http://examples.tobyinkster.co.uk/map/uk_map.png);
position:relative;
}
</style>
<script type="text/javascript">
var markersrc =(document.all && navigator.userAgent.indexOf("Opera")==-1)? "http://examples.tobyinkster.co.uk/map/marker.gif":"http://examples.tobyinkster.co.uk/map/marker.png";
function mapinit (o) {
var map = document.getElementById(o.ID);
var cities=o.CityArray||[]
this.marks=[];
for (var a,m,z0=0;z0<cities.length;z0++){
a=document.createElement('A');
map.appendChild(a);
if (cities[z0][3]){
a.href=cities[z0][3];
}
m=document.createElement('IMG');
m.src=o.MarkSRC;
m.width=o.MarkSize;
m.height=o.MarkSize;
m.alt=cities[z0][0];
m.style.position='absolute';
m.style.left=cities[z0][1]-o.MarkSize/2+'px';
m.style.top=cities[z0][2]-o.MarkSize/2+'px';
m.style.borderWidth='0px';
a.appendChild(m);
this.marks[z0]=m;
}
}
mapinit.prototype.maphide=function() {
for (var z0=0;z0<this.marks.length;z0++){
this.marks[z0].style.display = 'none';
}
}
mapinit.prototype.mapshow=function(city) {
if (this.marks[city]){
this.marks[city].style.display = 'block';
}
}
var M;
window.onload = function(){
M=new mapinit({
ID:'map',
MarkSize:32,
MarkSRC:markersrc,
CityArray:[
['London',248,320,'http://www.vicsjavascripts.org.uk/'],
['Birmingham',200,270],
['Manchester',200,235],
['Edinburgh',195,135],
['Cardiff',170,310,'http://www.dynamicdrive.com/forums/showthread.php?p=229363#post229363'],
['Belfast',115,180],
['Glasgow',165,140],
['Douglas',152,200],
['Liverpool',184,234],
['Newcastle',225,175]
]
});
}
</script>
<ul id="locations">
<li><a href="branch?b=Belfast" onmouseover="M.mapshow(5);" onmouseout="M.maphide();">Belfast</a>
<li><a href="branch?b=Birmingham" onmouseover="M.mapshow(1);" onmouseout="M.maphide();">Birmingham</a>
<li><a href="branch?b=Cardiff" onmouseover="M.mapshow(4);" onmouseout="M.maphide();">Cardiff</a>
<li><a href="branch?b=Douglas" onmouseover="M.mapshow(7);" onmouseout="M.maphide();">Douglas</a>
<li><a href="branch?b=Edinburgh" onmouseover="M.mapshow(3);" onmouseout="M.maphide();">Edinburgh</a>
<li><a href="branch?b=Glasgow" onmouseover="M.mapshow(6);" onmouseout="M.maphide();">Glasgow</a>
<li><a href="branch?b=Liverpool" onmouseover="M.mapshow(8);" onmouseout="M.maphide();">Liverpool</a>
<li><a href="branch?b=London" onmouseover="M.mapshow(0);" onmouseout="M.maphide();">London</a>
<li><a href="branch?b=Manchester" onmouseover="M.mapshow(2);" onmouseout="M.maphide();">Manchester</a>
<li><a href="branch?b=Newcastle" onmouseover="M.mapshow(9);" onmouseout="M.maphide();">Newcastle</a>
</ul>
<div id="map"> </div>
Bookmarks