我在此应用程序中添加了一个文本框和搜索按钮。我想输入一个位置并单击搜索按钮,然后它会显示带有天气详细信息的适当位置。我尝试了很多方法,但都行不通。所以谁有代码,然后请与我分享。谢谢你。
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<meta charset="utf-8">
<title>Weather layer</title>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=weather"></script>
<script>
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(12.9667, 77.5667),
zoom: 6,
mapTypeId: google.maps.MapTypeId.WeatherLayer
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var weatherLayer = new google.maps.weather.WeatherLayer({
temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT
});
weatherLayer.setMap(map);
var cloudLayer = new google.maps.weather.CloudLayer();
cloudLayer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="map-canvas"style="height:400px;width:400px;"></div>
<asp:Button ID="Button1" runat="server" Text="Proceed" />
<input id="searchTextField" type="text" size="50"style="height:auto;width:320px;">
</form>
</body>
</html>