Hi,
I have a requirement in my application to change the styles and images for the zoom and pan controls. I'm currenlty using the javascript routine below which works well for most of the images. However the zoom slider seems to always have a different id each time the user clicks the plus or minus button so I don't know how to programatically change it. How would I accomplish this?
function updateImages() {
var img = document.getElementById('PanZoomBar_zoomin_innerImage');
if (img)
{
img.setAttribute('src', '/theme/default/img/zoom_plus_mini.png');
img.setAttribute('style','position: relative; height: 22px; width: 23px;');
}
else {
setTimeout(updateImages, 250);
return;
}
img = document.getElementById('PanZoomBar_zoomout_innerImage');
if (img) {
img.setAttribute('src', '/theme/default/img/zoom_minus_mini.png');
img.setAttribute('style', 'position: relative; width: 22px; height: 23px;');
}
else {
setTimeout(updateImages, 250);
return;
}
img = document.getElementById('PanZoomBar_pandown_innerImage');
if (img) {
img.setAttribute('src', '/theme/default/img/south_mini.png');
//img.setAttribute('style', '');
}
else {
setTimeout(updateImages, 250);
return;
}
img = document.getElementById('PanZoomBar_panup_innerImage');
if (img) {
img.setAttribute('src', '/theme/default/img/north_mini.png');
//img.setAttribute('style', '');
}
else {
setTimeout(updateImages, 250);
return;
}
img = document.getElementById('PanZoomBar_panleft_innerImage');
if (img) {
img.setAttribute('src', '/theme/default/img/west_mini.png');
//img.setAttribute('style', '');
}
else {
setTimeout(updateImages, 250);
return;
}
img = document.getElementById('PanZoomBar_panright_innerImage');
if (img) {
img.setAttribute('src', '/theme/default/img/east_mini.png');
//img.setAttribute('style', '');
}
else {
setTimeout(updateImages, 250);
return;
}
img = document.getElementById('PanZoomBar_zoomworld_innerImage');
if (img) {
img.setAttribute('src', '/theme/default/img/zoom_world_mini.png');
// img.setAttribute('style', '');
}
else {
setTimeout(updateImages, 250);
return;
}
img = document.getElementById('PanZoomBar_OpenLayers.Map_2_innerImage')
if (img) {
img.setAttribute('src', '/theme/default/img/slider.png')
img.setAttribute('style', 'position: relative; width: 22px; height: 16px;');
}
else {
setTimeout(updateImages, 250);
return;
}
var div = document.getElementById('OpenLayers_Control_PanZoomBar_ZoombarOpenLayers.Map_2')
if (div) {
div.setAttribute('style', 'background-image: url(/theme/default/img/zoombar.png) !important; left: 25px !important; top: 81px; width: 16px !important; height: 110px; position: absolute;');
}
else {
setTimeout(updateImages, 250);
return;
}
}
Thanks!