Simple Button Example

button

Adds a button to the map

Simple button:

Only shows the zoom level, do zoomin when is activated and restore zoom when is deactivate:

activate: function(){ alert ('Active!!\nThe map has ' +map.zoom + ' zoom level'); map.setCenter(new OpenLayers.LonLat(lon, lat), map.zoom + 1); }, deactivate: function(){ alert('Do the zoom to '+zoom+ ' level!'); map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); }