On Dec 23, 11:34 am, Webmaster <[email protected]> wrote: > function MyApplication() { > this.counter = 0; > this.map = new GMap2(document.getElementById("map_canvas")); > this.map.setCenter(new GLatLng(37.4419, -122.1419), 13); > GEvent.bind(this.map, "click", this, this.onMapClick); > > } > > MyApplication.prototype.onMapClick = function() { > this.counter++; > alert("You have clicked the map " + this.counter + > (this.counter == 1 ?" time":" times")); > > } > > function initialize() { > if (GBrowserIsCompatible()) { > var application = new MyApplication(); > } > > } > > This is a example code taken from the google maps api documentation.
Where? > In the GEvent() function we refer to the method we want to bind the > event to as: > this.onMapClick. > It is my understanding that 'this' refers to 'MyApplication()' > so this.onMapClick = MyApplication.onMapClick > So why do we have > MyApplication.prototype.onMapClick = function() > Where does the 'prototype' come from? It is part of the javascript definition, please refer to the javascript specification or a javascript tutorial. -- Larry -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
