Is that the right syntax?<br><br>
<div class="gmail_quote">On Wed, Apr 2, 2008 at 12:16 PM, Christopher Schmidt &lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="Wj3C7c">On Wed, Apr 02, 2008 at 10:57:31AM -0600, Linda Rawson wrote:<br>&gt; I have several custom enhancements I have made to the source code. &nbsp;With the<br>&gt; onset of a new release I would like to put these in a separate file and<br>
&gt; &quot;override&quot; the code that is in the release. &nbsp;For instance I might want to<br>&gt; add the following function, just an example, it might already be in there to<br>&gt; Map.js<br>&gt;<br>&gt; getLayerByName: function(name) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;var foundLayer = null;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;for (var i = 0; i &lt; this.layers.length; i++) {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var layer = this.layers[i];<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (<a href="http://layer.name/" target="_blank">layer.name</a> == name) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;foundLayer = layer;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;return foundLayer;<br>&gt; &nbsp; &nbsp;},<br>&gt; Would I do something like the following in a .js file to be called after<br>&gt; Openlayers.js?<br>
&gt;<br>&gt; Map.prototype.getLayerByName=function(name) {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;var foundLayer = null;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;for (var i = 0; i &lt; this.layers.length; i++) {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var layer = this.layers[i];<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (<a href="http://layer.name/" target="_blank">layer.name</a> == name) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;foundLayer = layer;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;return foundLayer;<br>&gt; &nbsp; &nbsp;}<br>&gt;<br><br></div></div>Yes, this is what I would do.<br><br>Regards,<br><font color="#888888">--<br>
Christopher Schmidt<br>MetaCarta<br></font></blockquote></div><br><br clear="all"><br>-- <br>Linda Rawson