Effect (new Firefox test):
Code:
<! Doctype>
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8" >
<title>google map</title>
<script type= "Text/javascript" src= "Http://maps.google.com/maps/api/js?sensor=false" ></script>
<script type= "Text/javascript" >
function init ()
{
Get Current position
Navigator.geolocation.getCurrentPosition (function (position)
{
var coords = position.coords;
Set the map parameters, setting the latitude and longitude of the current position as the center point
var latlng = new Google.maps.LatLng (coords.latitude,coords.longitude);
var myoptions =
{
Magnification ratio
Zoom:14,
Callout coordinates
CENTER:LATLNG,
Map type
MapTypeId:google.maps.MapTypeId.ROADMAP
};
var map1;
Show Map
Map1 = new Google.maps.Map (document.getElementById (' Map '), myoptions);
Create a tag
var marker = new Google.maps.Marker (
{
POSITION:LATLNG,
Map:map1
});
Set callout window with note text
var Infowindow = new Google.maps.InfoWindow (
{
Content: "Current Position"
});
Open Callout Window
Infowindow.open (Map1,marker);
});
}
</script>
<body onload= "init ()" >
<div id= "Map" ></div>
</body>
Google Maps JavaScript API v3 (reference documentation): Https://developers.google.com/maps/documentation/javascript/basics
Reference document of Baidu Map API: http://developer.baidu.com/map/jsmobile.htm