Google Map未在容器中加载

时间:2013-02-08 16:05:13

标签: asp.net css google-maps google-maps-api-3

我正在尝试在<td>中加载Google地图,但我无法找到问题。

SCRIPT

function initialize() {
    var mapOptions = {
        center: new google.maps.LatLng(33, 73),
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map"),
            mapOptions);

}

HTML

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <table class="style1">
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="6" id="map" style="height:600px;">
                &nbsp;</td>
        </tr>
    </table>

</asp:Content>

您可以在下图中看到我的地图的加载方式,应该将其加载到浅灰色区域。 enter image description here

1 个答案:

答案 0 :(得分:3)

在td

中创建一个div
<td colspan="6" style="height:600px;">
        <div id="map" style="width:100%; height:100%"></div>         
</td>