[OpenLayers-Users] Button text, change innerHTML

Jordi Romagos i Figueras jordi_romagos at hotmail.com
Tue Apr 13 06:13:21 EDT 2010


I'm creating my own control panel outside of map and I wanna create one button just for put some variable info text.

 

This is my button code:

 

 var info = new OpenLayers.Control.Button({
                        type: OpenLayers.Control.TYPE_BUTTON
                        ,trigger: function() {}
                        ,id: "velInfoButton"
                        ,displayClass: "olControlButtonInfo"});


var  panel = new OpenLayers.Control.Panel({ div:OpenLayers.Util.getElement('cp') , displayClass:'dc' });

 

And then when I click another button just change innerHTML.

 

document.getElementById("velInfoButton").innerHTML = variable;

 

But my problem is the text goes to the upper left of the map div. 

 

 

I tried another solutions and the "best" was define id of button after I added the control panel. This solutions works in FF and not in IE.

 

 var info = new OpenLayers.Control.Button({
                        type: OpenLayers.Control.TYPE_BUTTON
                        ,trigger: function() {}
                        ,displayClass: "olControlButtonInfo"});

 

var  panel = new OpenLayers.Control.Panel({ div:OpenLayers.Util.getElement('cp') , displayClass:'dc' });

 

panel.addControls([my_buttons]);

info.panel_div.id  = "velInfoButton";

 

Can somebody help me to find one solution?

 

Thanks a lot!
 		 	   		  
_________________________________________________________________
¡Citas! ¡Ligues! ¿Salimos? ¿Cómo es tu pareja ideal? Búscala en el sitio nº1… ¡Regístrate ya!
http://contactos.es.msn.com/?mtcmk=015352
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100413/d735cd99/attachment.html


More information about the Users mailing list