How to call Baidu maps and precisely locate them and display them in a browser ., Precise call locating

Source: Internet
Author: User

How to call Baidu maps and precisely locate them and display them in a browser ., Precise call locating

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8"/>
<Title> Use of Baidu map API </title>
<! -- Baidu map API -->
<Script src = "http://api.map.baidu.com/api? V = 2 & ak = NfwgFTvB6mGSbcIlEHFlfxSZtPlA0xrn "type =" text/javascript "> </script>
<Script type = "text/javascript">
Function initialize (){
// Create a map instance
Var map = new BMap. Map ('map ');
// Create a Coordinate
Var point = new BMap. Point (121.433759, 28.659658 );
// Map initialization, set the coordinates of the center and map level
Map. centerAndZoom (point, 15 );
Map. addControl (new BMap. MapTypeControl ());
// Add controls and map controls
Map. enableScrollWheelZoom ();
// Enable scroll wheel zoom in and out
Map. enableContinuousZoom ();
// Enable map inertial drag.
Var marker = new BMap. Marker (point );
// Create Annotation
Map. addOverlay (marker );
// Add the annotation to the map
Var infoWindow = new BMap. InfoWindow ("I am here ");
// Create information window
Map. openInfoWindow (infoWindow, point );
// Open the Information Window

}
Window. onload = initialize;

</Script>
<Style type = "text/css">
# Map {
Margin: 0 auto;
Height: 600px;
Width: pixel PX;
}
</Style>
</Head>
<Body>
<! -- Baidu map container -->
<Div id = "map"> </div>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.