<div>I have several custom enhancements I have made to the source code. With the onset of a new release I would like to put these in a separate file and "override" the code that is in the release. For instance I might want to add the following function, just an example, it might already be in there to Map.js</div>
<div> </div>
<div>getLayerByName: function(name) {<br> var foundLayer = null;<br> for (var i = 0; i < this.layers.length; i++) {<br> var layer = this.layers[i];<br> if (<a href="http://layer.name">layer.name</a> == name) {<br>
foundLayer = layer;<br> }<br> }<br> return foundLayer;<br> },<br clear="all"></div>
<div>Would I do something like the following in a .js file to be called after Openlayers.js?</div>
<div> </div>
<div>Map.prototype.getLayerByName=function(name) {<br> var foundLayer = null;<br> for (var i = 0; i < this.layers.length; i++) {<br> var layer = this.layers[i];<br> if (<a href="http://layer.name">layer.name</a> == name) {<br>
foundLayer = layer;<br> }<br> }<br> return foundLayer;<br> }</div>
<div> </div>
<div>How do you do this?</div>
<div>-- <br>Linda Rawson </div>