参考サイト
Google Map JavaScript API(V3)
手順
1. script タグを使用して Maps API JavaScript を読み込み 2. 「map_canvas」という名前の div 要素を作成して、地図を保管 3. 多数の地図のプロパティを持つ JavaScript オブジェクトリテラルを作成 4. 「map」オブジェクトを作成する JavaScript 関数を記述 5. map オブジェクトを body タブの onload·イベントから初期化表示例
LINK
map.html
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(35.466188, 139.622715);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
0 件のコメント:
コメントを投稿