2、,>functionload(){〃检查浏览器的兼容性.if(GBrowser1sCompatib1e()){〃加载地图varmap=newGMap2(document.gctElcmentByld(〃map_canvas"));map.addControl(newGSmallMapControl());map.addControl(newGMapTypeControl());map.sctCcntcr(newGLatLng(39.9493,1
3、16.3975),13);//Createabaseiconforallofourmarkersthatspecifiesthe//shadow,icondimensions,etc.google,maps.LabclMarkcr二function(latlng,options){this.latlng二latlng;this.labelText=options.labelText
4、
5、;this.labelClass=options.labelClass
6、
7、5writeb5;this.labelOffset二options
8、,labelOffset
9、
10、newgoogle,maps.Size(8,~33);options.icon二options,icongetTextlconO;google,maps.Marker,apply(this,arguments);google,maps.LabelMarker.prototype二newgoogle,maps.Marker(newgoogle,maps.LatLng(0,0));initialize=function(map)e.initialize.cal1(this,map);document
11、.createElementCdiv");this.labelClass;this.labelText;'absolute";'48px';PANE).appendChild(label);e.redraw二function(force)e.redraw,call(this,map);google,maps.LabelMarker.prototype.{google,maps.Marker,prototypvarlabel=label.className二label.inncrllTML=label.style,posit
12、ion=label,style,width二map.getPane(G_MAP_MARKER_this.map=map;this,label二label;}google,maps.LabelMarker.prototyp{google,maps.Marker,prototypif(!force){return;}varpoint=this.map.fromLatLngToDivPixe1(this,latlng);varz二google,maps.Overlay.gctZIndex(this.latlng.lat());t
13、his,label,style,left=(point.x+this.labelOffset.width)+'px‘;this.label,style.top二(point.y+this.labelOffset.height)+'px";this.label,style,zlndex=z+1;}google,maps.LabelMarker.prototype,remove=function(){this.label,parentMode.removcChild(this.label);this.label=null;go
14、ogle,maps.Marker・prototype.remove,call(this);}varn=21;//在这里接收要显示的信息,文字要用双引号"functiongetTextlconO{varicon二newgoogle,maps.Icon();//icon,image=/zhttp:labs,