I am not familiar with event.observe but I do tie other events to the click of 
a query button.

 $( "#identify" ).button({
        text: true,     label: "Identify"
        })
        .click(function() {
        ctrl_disable();
        ctrl_identify.activate();
})

where ctrl_disable() looks like this and disables all my controls

function ctrl_disable() {
ctrl_pan.deactivate();
ctrl_identify.deactivate();
return;
}

and ctrl_identify is

ctrl_identify = new OpenLayers.Control.GetFeature({ whatever you need to put 
here )};


Ralph Dell


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of pascal
Sent: Thursday, December 13, 2012 4:57 AM
To: [email protected]
Subject: [OpenLayers-Users] OpenLayers.Event.observe();

Hi, 
I'm trying to use the OpenLayers.Event.observe(); function to integrate a
click event to a jQuery button but i don't know how to do:
That's what I'm doing:
1) 
I'm trying to integrate this fonction in the init() function:

mapelement1.addLayers([baselayer, wms1]); 
OpenLayers.Event.observe(OpenLayers.Util.getElement("boutton_map1"),
"onclick", alert(555));
} // End of init() function.

Then, I create the button in JQuery function:
$(document).ready(function()
{ 
        createmap1();
        // Create button:
        $('#boutton_map1').button();
}); // End JQuery function
}); // Fin JQ
 
Result: When the page start, I have the alert message 555 (I don't want
this!) but when I´m doing click on the button, noting occurs.

2) 
If I´m trying put the OpenLayers.Event.observe() function in the JQuery
function, it happens the same.

Two questions: 
1) what's wrong?
2) Is it possible to put the OpenLayers.Event.observe() function in the
JQuery function?

Thanks a lot, 

Pascal.




--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/OpenLayers-Event-observe-tp5022698.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to