<!DOCTYPE HTML><HTML><Head> <Metaname= "Viewport"content= "initial-scale=1.0, User-scalable=no" /> <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> <title>14.1</title> <Scripttype= "Text/javascript"> functionInitialize () {varMap= NewBmap.map ("Container", {minzoom: A, Maxzoom: - }); Map.centerandzoom ("Chengdu", -); Map.enablescrollwheelzoom (true); //---------------------------------------------right mouse button (zoom in, zoom out) operation--------------------------------------------- varMenu= NewBmap.contextmenu ();//Right-click menu varTxtmenuitem= [ //Right-click menu item{text:'Zoom in', Callback:function() {Map.zoomin ()}}, {text:'Zoom Out', Callback:function() {Map.zoomout ()}}, {text:'place to maximum level', Callback:function() {Map.setzoom ( -)}}, {text:'View the National', Callback:function() {Map.setzoom (4)}}, {text:'Add annotations here', Callback:function(p) {varMarker= NewBmap.marker (P), PX=Map.pointtopixel (P); Map.addoverlay (marker); } } ]; for (varI= 0; I<txtmenuitem.length; I++) {Menu.additem (NewBmap.menuitem (Txtmenuitem[i].text, Txtmenuitem[i].callback, -)); //Menu Add Item if(i== 1 ||I== 3) {menu.addseparator (); //add a split line to the right-click menu}} map.addcontextmenu (menu); //---------------------------------------------Change the mouse style--------------------------------------------- //need to make it yourself. static cursor in cur format //map.setdefaultcursor ("url (' 01.cur ')"); Set the default mouse pointer style for a map //map.setdraggingcursor ("url (' 03.cur ')"); Set the mouse pointer style when dragging a map } functionLoadscript () {varScript=Document.createelement ("Script"); SCRIPT.SRC= "http://api.map.baidu.com/api?v=1.4&callback=initialize"; Document.body.appendChild (script); } window.onload=Loadscript; </Script></Head><Body> <Divstyle= "float:left; width:100px;">1</Div> <DivID= "Container"style= "width:800px; height:500px"> </Div> <DivID= "R-result"style= "float:left; width:100px;">Print coordinates</Div> <DivID= "Result"> </Div></Body></HTML>
Baidu Map API Advanced Tutorial-MAP mouse Key operation example and mouse style 6.html