<!DOCTYPE HTML><HTML> <Head> <title></title> <MetaCharSet= "UTF-8" /> <styletype= "Text/css">Body, HTML{width:100%;Height:100%;margin:0;font-family:"Microsoft Jas Black";}
P{Margin-left:5px;font-size:14px;} </style> <Scripttype= "Text/javascript"src= "Key&v=2.0&services=false of http://api.map.baidu.com/api?ak= Application"></Script> </Head> <Body><BR/> <inputtype= "text"value=""ID= "keyword" /> <inputtype= "button"name=""ID=""value= "Query"onclick= "search ()" /> <Divstyle= "width:520px;height:340px;border:1px solid gray"ID= "Container"></Div> <PID= "AA"></P> <Scripttype= "Text/javascript"> //Create a Map instance varMap= NewBmap.map ("Container"); var Point= NewBmap.point (118.060576,36.842432); Map.centerandzoom (Point, the); //Add mouse Scrolling zoomMap.enablescrollwheelzoom (); //add a thumbnail controlMap.addcontrol (NewBmap.overviewmapcontrol ({isOpen:true, anchor:bmap_anchor_bottom_right})); //To add a zoom translation controlMap.addcontrol (NewBmap.navigationcontrol ()); //Add a scale bar controlMap.addcontrol (NewBmap.scalecontrol ()); //Add a Map type controlMap.addcontrol (NewBmap.maptypecontrol ()); //set the latitude and longitude of a callout varMarker= NewBmap.marker (NewBmap.point (118.040005,36.829665)); //add annotations to the mapMap.addoverlay (marker); varcontent= "<table>"; Content=content+ "<tr><td> Ref.:001</td></tr>"; Content=content+ "<tr><td> Location: Zibo Zhangdian District </td></tr>"; Content=content+ "<tr><td> Time:2014-09-26</td></tr>"; Content+= "</table>"; varInfowindow= NewBmap.infowindow (content); Marker.addeventlistener ("Click",function(){ This. Openinfowindow (Infowindow); }); //Click on the map to get latitude and longitude coordinatesMap.addeventlistener ("Click",function(e) {document.getElementById ("AA"). InnerHTML= "Longitude Coordinates:"+E.POINT.LNG+" Latitude Coordinates:"+E.point.lat; }); //keyword search functionsearch () {varkeyword=document.getElementById ("keyword"). Value; varLocal= NewBmap.localsearch (map, {renderoptions:{map:map}}); Local.search (keyword); } </Script> </Body></HTML>
JavaScript API v2.0:http://developer.baidu.com/map/index.php?title=jspopular
Baidu Map Bmap API Example