我在网页中嵌入了Google地图。现在我想在新的弹出窗口中打开相同的地图。任何人都可以告诉我怎么做吗?
我尝试了几个选项,我通过谷歌搜索和SF,但他们没有工作。在其中一个论坛中提到过包装带有标签的地图的div,但是必须将哪个URL传递给它?
@Update
以下是代码:
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false">
</script>
<script>
var amsterdam=new google.maps.LatLng(18.5204303,73.85624369999992);
var lat;
var long;
function initialize()
{
var mapProp = {
center:amsterdam,
zoom:8,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("googleMap"),mapProp);
var geocoder = new google.maps.Geocoder();
var reslatlon = null;
var location = "pune,maharashtra";
if(!geocoder) {
geocoder = new google.maps.Geocoder();
}
var geocoderRequest = {
address: location
}
var myCity = null;
geocoder.geocode(geocoderRequest, function(results, status) {
//alert(status);
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
reslatlon = results[0].geometry.location;
lat = results[0].geometry.location.hb;
long = results[0].geometry.location.ib;
amsterdam = new google.maps.LatLng(results[0].geometry.location.hb,results[0].geometry.location.ib);
//alert(results[0].geometry.location.hb + " , " + results[0].geometry.location.ib);
myCity = new google.maps.Circle({
center:amsterdam,
radius:25000,
strokeColor:"#0000ff",
strokeOpacity:0.8,
strokeWeight:2,
fillColor:"#0000ff",
fillOpacity:0.4,
map:map
});
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
function openWin(){
alert(lat + " , " + long);
window.open("http://maps.google.com/maps? ll="+lat+","+long,'MYMAP','height=400,width=600');return true;
}
</script>
</head>
<body>
<a target="MYMAP" onclick="openWin()" href="">
<div id="googleMap" style="width:500px;height:380px;"></div></a>
</body>
</html>