将Google地图位置网址添加到文本框中

时间:2012-10-11 19:22:51

标签: php google-maps

我对Google地图很新,在我的项目中,有这样的要求。

有用于打开Goog​​le地图的链接,当用户点击该链接时,会出现Google地图,当他从地图中选择一个位置时,该位置的网址应填入文本框,

有没有办法做到这一点?因为我需要将其保存在数据库中,并且必须在Web服务中使用。

任何建议也欢迎。

2 个答案:

答案 0 :(得分:2)

查看google关于活动的文档:https://developers.google.com/maps/documentation/javascript/events

google.maps.event.addListener(map, 'click', function(event) {
   //event.latLng is the lat long of the click's location
   //At this point you could do a document.getElementById("someId").value= ... to cahnge the text box
});

答案 1 :(得分:0)

这不是你问题的确切答案,但是因为你刚开始使用google-maps + db + webservice,你可能最好从这个官方教程开始 Creating a Store Locator with PHP, MySQL & Google Maps

相关问题