<?php ?>
<!DOCTYPE html>
<html>enter code here
<head>
一番下のMap_canvasのメッセージですか?
<style type="text/css">
html { height: 100% }
body { height: 100%; }
#map_canvas { height: 50% ; width:50%}
</style>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
var marker2;
function initialize()
{
var athens = new google.maps.LatLng(37.958592, 23.686191);
var myOptions = {
zoom: 12,
center: athens,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var marker1 = new google.maps.Marker({
position: athens,
map: map,
title: ""
});
これはオートコンプリート セクションです。ここにエラーがある可能性が最も高いです。//-------------------------オートコンプリート---------------------- ----
var input = document.getElementById('location');
var autocomplete = new google.maps.places.Autocomplete(input);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
infowindow.close();
marker.setVisible(false);
input.className = '';
var place = autocomplete.getPlace();
if (!place.geometry) {
// Inform the user that the place was not found and return.
input.className = 'notfound';
return;
}
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] && place.address_components[0].short_name || ''),
(place.address_components[1] && place.address_components[1].short_name || ''),
(place.address_components[2] && place.address_components[2].short_name || '')
].join(' ');
}
infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
});
setupClickListener('changetype-geocode', ['geocode']);
// autocomplete results:
google.maps.event.addDomListener(window, 'load', initialize);
//---------------------------------------------------------------
これらの機能は、マーカーの配置、新しいマーカーの追加、および前のマーカーの削除用です
function putMarker(Location)
{
var newpos = new google.maps.LatLng(Location);
marker2 = new google.maps.Marker({
position: newpos,
map: map,
title: ""
});
}
function addMarker()
{
var Location = document.getElementById("lacation").value;
var title= document.getElementById("mark").value;
var newpos = new google.maps.LatLng(Location);
marker2 = new google.maps.Marker({
position: newpos,
map: map,
title: title
});
}
function removeMarker()
{
marker2.setMap(null);
}
</script>
</head>
ここに体があります
<body onload="initialize()">
<div id="map_canvas" style="float: left; margin-right: 40px;border: 1px solid black;"></div>
<div id="Panel" style="border: 1px solid black;" >
<table>
<tr>
<td>Location:</td>
<td><input type="text" id="location" name="Location search"/></td>
<tr><br>
<td> Title:</td>
<td><input type="text" id="mark" name="Title of Marker"/></td>
</tr><br>
<td>What the problem is?:</td>
<td><textarea rows="3" cols="50" name="explaination"></textarea></td>
</tr><br>
<td><input type="button" value="Add" id="buttonadd" onclick="addMarker()"/></td>
<td><input type="button" value="Remove" id="buttonremove" onclick="removeMarker()"/></td>
</table>
</div><br><br>
</body>
</html>**
マップの読み込みに失敗しました(これが主な問題ですが、「オートコンプリート」も失敗しています。経験豊富な目で見ると、私には見えない私のエラーを見ることができます