如何指出Google地圖中的特定位置?我試圖看過以前的問題,但我沒有找到任何可以「幫助」我的東西。如何指出Google地圖中的特定位置?
的JavaScript
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize() {
var mapCanvas = document.getElementById('map');
var mapOptions = {
center: new google.maps.LatLng(58.393584, 15.566656),
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(mapCanvas, mapOptions)
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
CSS
#map {
width: 500px;
height: 400px;
float: left;
margin: 10px;
margin-top: 15px;
}
(忽略margin
和float
),它放大到位置,但我怎麼可以添加一個指向它?指針的圖像會做什麼?可能是一個新手問題,但是如果你能幫助我的話,謝謝。
谷歌[圖](https://developers.google.com/maps/documentation/javascript/examples/marker-simple )[文檔](https://developers.google.com/maps/documentation/javascript/)(向下滾動並點擊標記) –
@JaromandaX我應該只將標記代碼放入我的腳本中,或者放在哪裏? –
是的,我個人將JavaScript代碼放在腳本中 –