大家好,提前感谢您的意见和建议。
1 - 我在可下载的公共表“1wPUbMMUyZQkrodr7zk6-_mYJmH4RPc48NvDuzBY”中过滤两列(频道和扇区)时遇到问题
2 - 表格中的样式未显示在地图上。
这是我正在使用的代码。请随时提出建议或更正。
<!DOCTYPE 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"/>
<title>Malawi EN</title>
<!-- Style -->
<style>
body { font-family: Arial, sans-serif; }
#map_canvas { height: 700px; width:1056px; }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var tableid = "1wPUbMMUyZQkrodr7zk6-_mYJmH4RPc48NvDuzBY";
var layer = new google.maps.FusionTablesLayer(tableid);
function initialize() {
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(-13.731381,34.002686),
zoom: 7,
mapTypeControl: true,
panControl: false,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
},
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl:false
});
layer.setMap(map);
}
//Change the query based on the user's selection
function changeMap(sector, channel) {
sector = document.getElementById('sector').value;
channel = document.getElementById('channel').value;
layer.setQuery("SELECT lat FROM " + tableid + " WHERE sector MATCHES '%" + sector + "%' AND channel MATCHES '" + channel + "'");
}
</script>
</head>
<body onLoad="initialize();">
<h3>Malawi</h3>
Channel of Aid: <select id="channel" onChange="changeMap();">
<option value="%"> All </option>
<option value="bilateral">Bilateral</option>
<option value="multilateral">Multilateral</option>
<option value="partnership">Partnership</option>
</select>
Sector: <select id="sector" onChange="changeMap();">
<option value="%"> All </option>
<option value="Improving health">Improving health</option>
<option value="Private sector development">Private sector development</option>
<option value="Environment">Environment</option>
<option value="Democratic governance">Democratic governance</option>
<option value="Strengthening basic education">Strengthening basic education</option>
<option value="Peace and security">Peace and security</option>
<option value="Emergency assistance">Emergency assistance</option>
<option value="Other">Other</option>
</select>
<div id="map_canvas"></div>
</body>
</html>