擅长:python、mysql、java
<p>您可以使用Google API的内置<a href="http://code.google.com/apis/ajax/documentation/#ClientLocation" rel="noreferrer">ClientLocation</a>对象:</p>
<pre><code>if (GBrowserIsCompatible())
{
var map = new google.maps.Map2(document.getElementById("mapdiv"));
if (google.loader.ClientLocation)
{
var center = new google.maps.LatLng(
google.loader.ClientLocation.latitude,
google.loader.ClientLocation.longitude
);
var zoom = 8;
map.setCenter(center, zoom);
}
}
</code></pre>