<html>
<head>
<title>Map Simple Event</title>
<script type="text/javascript" src="http://js.sapo.pt/Bundles/SAPOMapsAPI.js"></script>
<script type='text/javascript'>
window.onload = init;
var map = false;
var marker = false;
var polyline = false;
var polygon = false;
function init() {
map = new SAPO.Maps.Map('mapDiv');
marker = new SAPO.Maps.Marker(new OpenLayers.LonLat(-9, 38), {draggable: true});
map.addOverlay(marker);
marker.registerEvent('click', this, click);
marker.registerEvent('mouseover', this, mouseover);
marker.registerEvent('mouseout', this, mouseout);
marker.registerEvent('drag', this, drag);
}
function click(marker){
writeMsg('marker was clicked');
}
function mouseover(evt){
writeMsg('The mouse is on the marker');
}
function mouseout(){
writeMsg('The mouse is out of the marker');
}
function drag(){
writeMsg('marker is moving');
}
function writeMsg(msg){
var panel = document.getElementById('msgs');
panel.innerHTML += msg + '<br/>'
}
</script>
</head>
<body onload='init();'>
<div id='mapDiv' style='width:980px; height:400px;'></div>
<div id='msgs'></div>
</body>
</html>