2012-11-12 37 views
0

我想知道是否有人知道一個好的Javascript /查詢地圖控件,允許用戶點擊一個位置。一旦完成,控制器將回調用戶剛選擇的GPS座標。尋找一個帶有回調的JS地圖控件

有誰知道這樣的控制。

我一直在尋找,但還沒有找到任何東西。

這是在MVC3應用程序中使用。

歡迎任何建議。

+0

谷歌地圖API? –

+0

我一直在看這個,但不能解決如何在用戶選擇一個點時得到回調。你知道這可能嗎? –

+0

你在看什麼? – Bergi

回答

4

從谷歌地圖API(https://developers.google.com/maps/documentation/javascript/events#EventListeners)

var map; 
function initialize() 
{ 
    var myLatlng = new google.maps.LatLng(-25.363882,131.044922); 
    var mapOptions = 
    { 
     zoom: 4, 
     center: myLatlng, 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
    } 

    map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); 

    google.maps.event.addListener(map, 'click', function(event) 
    { 
     placeMarker(event.latLng); 
    }); 
} 

function placeMarker(location) 
{ 
    var marker = new google.maps.Marker(
    { 
     position: location, 
     map: map 
    }); 

    map.setCenter(location); 
} 

演示https://google-developers.appspot.com/maps/documentation/javascript/examples/event-arguments

+0

太棒了,完美。我沒有看夠難對不起。 –