<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Also,<br>
<br>
you could concentrate on your css styles. I really don't understand
them, but they have something to do with the functioning. If I add
'ItemInactive' into your style in Firebug, the button works. Maybe <b>*someone
could explain*</b> this button thing to us who don't get it. I have
been using the following styles and activating/deactivating my buttons
by demand.<br>
<br>
.olControlPanel div {<br>
display:block;<br>
width: 24px;<br>
height: 24px;<br>
margin: 5px;<br>
background-color:red;<br>
position: absolute;<br>
top: 100px;<br>
left: 10px;<br>
}<br>
<br>
.olControlPanel .infoItemActive { <br>
background-color: green;<br>
background-image: url("./OpenLayers-2.7/info_on.png");<br>
position: absolute;<br>
top: 140px;<br>
left: 10px;<br>
}<br>
<br>
.olControlPanel .infoItemInactive { <br>
background-color: blue;<br>
background-image: url("./OpenLayers-2.7/info_off.png");<br>
position: absolute;<br>
top: 140px;<br>
left: 10px;<br>
}<br>
<br>
Of course you have to change the displayClass ( Mine is 'info' in this
example.) This cretes two-state button (different image when on and
off).<br>
<br>
- mika -<br>
<br>
Arnd Wippermann kirjoitti:
<blockquote cite="mid:E1LUR6B-0005Oe-00@smtp07.web.de" type="cite">
<pre wrap="">Hi,
Perhaps you have to activate the control:
panel.activateControl(button);
Arnd Wippermann
-----Ursprüngliche Nachricht-----
Von: <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a> [<a class="moz-txt-link-freetext" href="mailto:users-bounces@openlayers.org">mailto:users-bounces@openlayers.org</a>] Im
Auftrag von JuergenL
Gesendet: Dienstag, 3. Februar 2009 19:56
An: <a class="moz-txt-link-abbreviated" href="mailto:users@openlayers.org">users@openlayers.org</a>
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: <a class="moz-txt-link-freetext" href="http://albspotter.org/osm/test.php">http://albspotter.org/osm/test.php</a>
Can anyone tell why this doesn't work?
Thanks in advance
Juergen
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>
</pre>
</blockquote>
</body>
</html>