3

我有一个谷歌地图要显示在页面上,它在其他浏览器上都可以正常工作,除了 IE 8 不确定上述版本的 IE ..

问题是大多数用户都使用 IE,我想解决它为什么不能在 IE 上运行?

$table = "";
        while ( $row = mysql_fetch_array($result)) {

            $table .= "<table border = \"1\" width=\"800px\">  

                    <tr><td style = \"background:#EEEEEE;\"><b>Arka</b></td>   <td align=\"left\" width= \"220px\" style = \"background:#EEEEEE;\">{$row['arka']}</td> <td width = \"480px\" rowspan = \"4\"> <div style = \"width:480px; height:230px;\" id= \"div-{$row['id']}\">Map here</div></td> </tr>
            <tr><td><b>Orari</b></td>  <td align=\"left\">{$row['orari']}</td></tr>  
            <tr><td><b>Pauza</b> </td>  <td align=\"left\">{$row['pauza']}</td></tr>  
            <tr><td><b>Shtune</b></td> <td align=\"left\">{$row['shtune']}</td></tr>  
            </table> <br>";

            echo '<script type="text/javascript" language="javascript">loadMap("'.$row['adresa'].'",'.$row['id'].');</script>';

            }
            echo $table;
                ?>

end 这里是加载地图的函数:

function loadMap(street,div_id) {


$.ajax({ 
        type: 'GET', 
        url: "http://maps.googleapis.com/maps/api/geocode/json?address="+street+",Prishtina&sensor=true", 
        dataType: 'json',
        success: function (data) { 

            $.each(data, function() {
                $.each(this, function(key, value) {
                    switch (key) {

                        case "lat":

                        alert(value) // access to this node works fine                      
                        break;

                        case "lng":

                        alert(value) // access to this node works fine                      
                        break;

                        default: 
                        //window.alert(divid);

                        var myCenter=new 
           google.maps.LatLng(value.geometry.location.lat,value.geometry.location.lng);
                        var mapProp = {
                            center: myCenter,
                            zoom:17,
                            mapTypeId: google.maps.MapTypeId.ROADMAP
                        };

                        var map = new           
                            google.maps.Map(document.getElementById("div-" +  
                            div_id),mapProp);
                        var marker = new google.maps.Marker({
                            position: myCenter,
                            title:'Click to zoom',
                            //icon: 'img/logo3.png'


                        });

                        marker.setMap(map);

        // Zoom to 9 when clicking on marker
        google.maps.event.addListener(marker,'click',function() {
            map.setZoom(9);
            map.setCenter(marker.getPosition());
        });

        break;
           }       
               });
                   });
                   }
                   });
4

1 回答 1

1

使用任何基于Canvas的东西(几乎所有的 Google 对象都是)。您需要包括excanvas

head只需在 HTML 的标签中添加以下内容。

<script language="javascript" type="text/javascript" src="Path/to/excanvas.min.js"></script>

要使其仅在 IE 中加载,请执行以下操作:

<![if !IE]>
    <script language="javascript" type="text/javascript" src="Path/to/excanvas.min.js"></script>
<![endif]>
于 2013-07-10T13:39:57.237 回答