[OpenLayers-Users] Problem with OpenLayers.Control.Button
Arnd Wippermann
arnd.wippermann at web.de
Tue Feb 3 14:38:16 EST 2009
Hi,
Perhaps you have to activate the control:
panel.activateControl(button);
Arnd Wippermann
-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von JuergenL
Gesendet: Dienstag, 3. Februar 2009 19:56
An: users at openlayers.org
Betreff: [OpenLayers-Users] Problem with OpenLayers.Control.Button
Hi,
I'm new to OpenLayers and I try to add my own button to OpenLayers that
calls a JavaScript function when clicked. The button is visible but nothing
happens when I click on it.
That's how I define the button:
var panel = new OpenLayers.Control.Panel();
var button = new OpenLayers.Control.Button({displayClass:
"addMarkerBtn", trigger: addMarker});
panel.addControls([button]);
map.addControl(panel);
And the function addMarker:
addMarker = function() {
alert('test');
}
I also tried
function addMarker() {
alert('test');
}
Here is a complete test page: http://albspotter.org/osm/test.php
Can anyone tell why this doesn't work?
Thanks in advance
Juergen
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list