HOME BLOG

MAPAS API

Galeria de exemplos: Eventos do mapa (clique)

Este exemplo captura o clique sobre o mapa e para sinalizar, chama a função alert. Para ver o exemplo a funcionar, tente clicar sobre o mapa.

				<html>
					<head>
						<title>Map Simple Event</title>
						<script type="text/javascript" src="http://js.sapo.pt/Bundles/SAPOMapsAPI.js"></script>
						<script type='text/javascript'>
							
							var map = false;
							function init() { 
								map = new SAPO.Maps.Map('mapDiv');
								map.events.register('click', this, clicked);
							}
							
							function clicked(evt){
								alert('you clicked on the map');
							}
							
						</script>
					</head>
					<body onload='init();'>
						<div id='mapDiv' style='width:980px; height:400px;'></div>
					</body>
				</html>