Google Maps事件
来源:互联网 发布:淘宝怎么找同款店铺 编辑:程序博客网 时间:2024/05/16 01:13
您可以利用事件监听器在您的程序里面加入动态元素。一个对象导出命名事件,您的程序可以用静态方法GEvent.addListener和GEvent.bind来"监听"这些事件。例如,这个代码片断在每次用户点击的时候显示一个警告框:
var map = newGMap2(document.getElementByIdx("map"));map.setCenter(newGLatLng(37.4419, -122.1419), 13);GEvent.addListener(map, "click",function() { alert("You clicked the map.");});GEvent.addListener把一个函数当作第三个参数,用来指定时间句柄的相应函数。想把事件绑定到类实例的方法上,可以用GEvent.bind方法。在下面的例子里,应用程序类实例把地图事件绑定在他的方法上,在触发的时候修改类的状态:
function MyApplication() { this.counter = 0; this.map = newGMap2(document.getElementByIdx("map")); this.map.setCenter(newGLatLng(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"));}varapplication = new MyApplication(); //参照JavaScript自定义对象和类的方法理解说明:#电子地图api
0 0
- Google Maps事件
- Google Maps事件
- google Maps覆盖对象
- google Maps API(1)
- google Maps API(1)
- 【转】Google Maps 图标
- google maps api事件注册
- google.maps.Map 的事件
- FW:Google Maps API编程资源大全
- Google Maps API V3 的事件
- Google Maps
- google maps
- Google Maps API 说明
- baidu & google maps 分析
- Google Maps API
- Google maps切割方法
- Google Maps Hacks
- 学习 Google Maps API
- ArcGIS API for Silverlight学习笔…
- 根据三点创建圆弧
- 设计模式实训教程
- ArcEngine调用GP工具传入参数心得
- Android系统手机端抓包方法
- Google Maps事件
- 为什么反射机制要依赖类的无参构造方法
- 看SIFT有感触
- GIS地图图片服务(转载)
- ArcEngine调用GP工具之Erase总是报…
- AutoCAD二次开发之.net API学习笔…
- python (第十周)编玛规则、变量和常量、数据类型、运算符与表达式
- 记录一个IOS开发Bug消除的经历
- ArcEngine调用GP工具传入参数心得