Create a function -- OpenLayers.Util.getElement -- which replaces "$". This
should be used in all library code. This patch replaces all uses of "$()" in existing code. The primary reason for this is to avoid conflicts with libraries (like Prototype) which might redefine this function differently. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2541 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
var map, layer;
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map( $('map'), {maxResolution:1.40625/2} );
|
||||
map = new OpenLayers.Map( 'map', {maxResolution:1.40625/2} );
|
||||
layer = new OpenLayers.Layer.TMS( "TMS",
|
||||
"http://labs.metacarta.com/wms-c/Basic.py/", {layername: 'basic', type:'png'} );
|
||||
map.addLayer(layer);
|
||||
@@ -24,9 +24,15 @@
|
||||
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
||||
}
|
||||
function addTMS() {
|
||||
l=new OpenLayers.Layer.TMS($('layer').value, $('url').value, {layername: $('layer').value, type:$('type').value});
|
||||
map.addLayer(l);
|
||||
map.setBaseLayer(l);
|
||||
l = new OpenLayers.Layer.TMS(
|
||||
OpenLayers.Util.getElement('layer').value,
|
||||
OpenLayers.Util.getElement('url').value,
|
||||
{
|
||||
'layername': OpenLayers.Util.getElement('layer').value,
|
||||
'type': OpenLayers.Util.getElement('type').value
|
||||
});
|
||||
map.addLayer(l);
|
||||
map.setBaseLayer(l);
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user