Google地图未在IE / FF中显示

时间:2013-10-19 15:34:49

标签: javascript html html5

此地图在Chrome中完美运行,但在IE和FF中显示如下;

http://imgur.com/xuLVSUS

这是我的代码:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=AIzaSyBTbIpaaV72BfdUL3aOSU8dER1oUaso79o"></script>

<script type="text/JavaScript">
    //<![CDATA[
        function addLoadEvent(func) 
        {
            var oldonload = window.onload;

            if (typeof window.onload != 'function')
            {
            window.onload = func;
            } 
            else 
            {
            window.onload = function() 
                    {
                            if (oldonload) 
                            {
                            oldonload();
                            }
                    func();
                    }       
            }
        }
        addLoadEvent(load);
        //]]>
    </script>

    <div id="map" style="width:970px; height:600px; border: 1px solid #000; margin:0 auto;" ></div>

1 个答案:

答案 0 :(得分:1)

尝试

<script src="https://maps.google.com/maps?file=api&amp;v=2&amp;key=AIzaSyBTbIpaaV72BfdUL3aOSU8dER1oUaso79o"></script> 
                 ^

而不是

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=AIzaSyBTbIpaaV72BfdUL3aOSU8dER1oUaso79o"></script>