Hi, Perhaps you have to activate the control: panel.activateControl(button);
Arnd Wippermann -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von JuergenL Gesendet: Dienstag, 3. Februar 2009 19:56 An: [email protected] 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 [email protected] http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
