<! DOCTYPE html>
<meta charset= "Utf-8"/>
<meta name= "viewport" content= "initial-scale=1.0, User-scalable=no"/>
<title> Test Positioning </title>
<script type= "Text/javascript" src= "http://api.map.baidu.com/api?v=1.4" ></script>
<style type= "Text/css" >
#mapContainer {width:100%;height:400px;border:1px solid gray;} </style>
<body>
<div id= "Mapcontainer" ></div>
<script type= "Text/javascript" >
var origin = "0,0";
var origin_region = "";
var point = new Bmap.point (118.185789, 24.489321);
var map = new Bmap.map ("Mapcontainer");
Map.enablescrollwheelzoom ();
Map.centerandzoom (Point, 15);
var marker = new Bmap.marker (point);
Map.addoverlay (marker);
var gectrl=new bmap.geolocationcontrol ({
Anchor:bmap_anchor_top_left,
Enableautolocation:true});
Map.addcontrol (Gectrl); Add positioning controls
var mycity = new Bmap.localcity ();
Mycity.get (function (result) {origin_region = result.name;});
var geolocation = new Bmap.geolocation ();
Geolocation.getcurrentposition (function (r) {
if (this.getstatus () = = bmap_status_success) {
Origin = R.point.lng + "," + R.point.lat;
Alert (origin);
}
})
</script>
</body>