HTML タグ例 ↓
地図表示
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0">
<title>Simple Map</title>
<script src="https://maps.googleapis.com/maps/api/js?key=【API キー】&callback=initMap" async defer></script>
<style>
html, body { height: 100%; margin: 0; padding: 0; }
#gmap { width:98%; height:500px; margin: 0 auto; }
</style>
<script>
var mapobj;
var mark = {lat:35.680929,lng:139.767020 }; // 東京駅(北緯度,東経度)
function initMap() {
mapobj = new google.maps.Map(document.getElementById('gmap'), {
center: mark, // 地図の中心位置を指定
zoom: 13 // ズームレベルを指定
});
var marker = new google.maps.Marker({
position: mark, // マーカーの位置
label: '+', // マーカーラベルの文字
title: '地図中央', // マーカーのタイトル
map: mapobj // マーカーを mapobj に設定
});
const infowindow = new google.maps.InfoWindow({
content: "東京駅です<br><a href='https://www.jreast.co.jp/estation/stations/1039.html'>駅構内図</a>が見られます"
});
marker.addListener("click", function(){
infowindow.open(mapobj, marker);
});
}
</script>
</head>
<body>
<div id="gmap"></div>
</body>
</html>