I want to show multiple google map canvases in one window but it isnt working. The maps created in the for loop all just appear grey with nothing on them and I cant figure out why.
HTML
<div id="routeContainer">
<table>
<tr id="routeContainerTR">
</tr>
</table>
</div>
Jquery/Javascript
<script type="text/javascript">
var margin = 50;
var maps = [];
for (var i = 0; i < 5; i++) {
$("#routeContainer").append("<td><div style='margin-left: " + margin + "px;' class = 'test'>hello world<div style='width:100%; height:100%; float:left;' id='map-canvas" + i + "'></div></div></td>");
var mapOptions = {
zoom: 10,
scrollwheel: false
};
maps[i] = new google.maps.Map(document.getElementById('map-canvas'+i),mapOptions);
};
</script>
If someone could tell me what Im doing wrong that would be awesome!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…