現在,我目前正在創建的地圖,將有一個JavaScript菜單,允許用戶更改使用谷歌的融合表覆蓋不同的地圖視圖。如果你能幫我解決一個阻礙我完成項目的問題,我將非常感激。問題的JavaScript菜單上的谷歌地圖API使用fusiontables
這是我的谷歌地圖HTML頁面:當我加入這樣的代碼發生
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<!DOCTYPE html>
<title>Met Sacramento Internship Map</title>
<!-- Style -->
<style>
body { font-family: Arial, sans-serif; }
#map_canvas { height: 500px; width:600px; }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var tableid = 567682;
var layer = new google.maps.FusionTablesLayer(567682);
function initialize() {
var latlng = new google.maps.LatLng(37.5213829, -122.172534);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
layer.setMap(map);
}
//Change the query based on the user's selection
function changeMap(delivery) {
layer.setQuery("SELECT Address FROM " + tableid + " WHERE delivery LIKE '" + delivery + "'");
}
</script>
</script>
</head>
<body onload="initialize();">
Internship Status <select onchange="changeMap(this.value);">
<option value="%">--Select--</option>
<option value="ANIMALS">Animals</option>
<option value="BUSINESS">Business</option>
</select> <div id="map_canvas"></div>
</body>
</html>
我的問題:
//Change the query based on the user's selection
function changeMap(animals) {
layer.setQuery("SELECT Address FROM " + tableid + " WHERE Animals LIKE '" + Animals + "'");
任何幫助將不勝感激,我是相當新的融合表, Google Maps API和Javascript。
我不知道爲什麼你的DOCTYPE是標題標籤下面...... – tcooc 2011-03-18 15:47:06
我不認爲有用我的問題做。 – Noah 2011-03-18 16:00:27