I want to run this JavaScript function on asp.net button click event.But map didn’t get loaded when i click the button.Here is my code.Please help me.
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
</script>
//This is my JavaScript function
<script type="text/javascript">
var map;
var layerl0;
function initializes()
{
map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(16.003575733881323, 81.298828125),
zoom: 5,
mapTypeId: google.maps.MapTypeId.HYBRID
});
layerl0 = new google.maps.FusionTablesLayer({
query: {
select: "'geometry'",
from: '4757916',
where: "Address='kerala'"
},
map: map
});
}
</script>
// This is asp.net code
<body>
<form id="form1" runat="server">
<div>
<div>
<div id="map-canvas" style="height: 421px"></div>
</div>
<asp:Button ID="Button1" OnClientClick="initializes()" runat="server" Text="Button" />
</div>
</form>
</body>
Copied from my comment above:
And a Fiddle: http://jsfiddle.net/qbjAD/