In order to set the status of an element before it's added ot the DOM in IE,

you have to use "defaultChecked" rather than "checked". So, we'll set both --
one for IE, one for Firefox -- and call it done.

I want the last three days of my life back.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1330 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-22 14:23:23 +00:00
parent 402021f24f
commit a6ff5584ad

View File

@@ -119,7 +119,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
inputElem.type = (baseLayer) ? "radio" : "checkbox"; inputElem.type = (baseLayer) ? "radio" : "checkbox";
inputElem.value = layer.name; inputElem.value = layer.name;
inputElem.checked = checked; inputElem.checked = checked;
inputElem.checked = checked; inputElem.defaultChecked = checked;
inputElem.layer = layer; inputElem.layer = layer;
inputElem.control = this; inputElem.control = this;
Event.observe(inputElem, "mouseup", Event.observe(inputElem, "mouseup",
@@ -164,11 +164,13 @@ OpenLayers.Control.LayerSwitcher.prototype =
onInputClick: function(e) { onInputClick: function(e) {
if (this.type == "radio") { if (this.type == "radio") {
this.checked = true; this.checked = true;
this.layer.map.setBaseLayer(this.layer, true);
this.layer.map.events.triggerEvent("changebaselayer");
} else { } else {
this.checked = !this.checked; this.checked = !this.checked;
this.control.updateMap();
} }
Event.stop(e); Event.stop(e);
this.control.updateMap();
}, },
/** Need to update the map accordingly whenever user clicks in either of /** Need to update the map accordingly whenever user clicks in either of