Monday, December 04, 2006

Finding map buttons

The string variables listed earlier can be used to identify map buttons.
var divs = map.getContainer().getElementsByTagName("div");
for(var i = 0; i<divs.length; i++)
{
var title = divs[i].getAttribute("title");

if(title==_mZoomIn)
{
zoomInButton=divs[i];
}}
Now variable 'zoomInButton' is the container of 'Zoom In' button and you can change its style or construct an event listener.

Update 2008. Excpected lifespan of this kind of hacks is a few months. This hasn't been working for a long time. if(title=="Zoom in") works but but you have to lock the language to hl=en.

No comments: