Right, the constructor for the Scale Control is a bit different: /** * Constructor: OpenLayers.Control.Scale * * Parameters: * element - {DOMElement} * options - {Object} */ initialize: function(element, options) { OpenLayers.Control.prototype.initialize.apply(this, [options]); this.element = OpenLayers.Util.getElement(element); },
So try: new OpenLayers.Scale(document.getElementById("scale")) I'll file a bug so we fix this up in 3.0. Thanks for the report. Bart -- Looking for flexible support on OpenLayers or GeoExt? Please check out http://www.osgis.nl/support.html Bart van den Eijnden OSGIS bart...@osgis.nl On Aug 29, 2010, at 7:00 AM, P Kishor wrote: > // the following works > var cs = new OpenLayers.Control.Scale(); > cs.div = document.getElementById("scale"); > this.map.addControl(cs); > > // The following also works > this.map.addControl(new OpenLayers.Control.MousePosition({div: > document.getElementById("coords")})); > > // The following does not work. Why? > this.map.addControl(new OpenLayers.Control.Scale({div: > document.getElementById("scale")})); > > > > > -- > Puneet Kishor > _______________________________________________ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users