0

AnyBody が私を助けてくれます。Google マップ v3 コードで行き詰まりました。Google マーカー オブジェクトを使用してマーカー イメージを設定すると、ブラウザ ウィンドウでエラーが表示されます。イメージ マーカー文字列のエスケープ文字を変更しましたが、機能しません。私を助けてください 。

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>



 <table>
<tr>
 <td><script type="text/javascript" charset="utf-8">
      </script>
    </td>
 <td><div id="sidebar_GoogleMaps1" class="sidebar_GoogleMaps1"></div>
</td>
</tr>
</table>

<script type="text/javascript" charset="utf-8">
//<![CDATA[
            var markersGoogleMaps1  = [];

                var sidebar_htmlGoogleMaps1  = '';
                var marker_htmlGoogleMaps1  = [];
            var iconGoogleMaps1  = []; 


              iconGoogleMaps1['uploads\GoogleMaps\markers\m_28_orangepng'].image =  new google.maps.MarkerImage('http://localhost/sites/sinmar\uploads\GoogleMaps\markers\m_28_orange.png',

                  new google.maps.Size(16, 28),

                  new google.maps.Point(0,0),

                  new google.maps.Point(8, 14)
              );
            var mapGoogleMaps1 = null;
{
 var mapObjGoogleMaps1 = document.getElementById("GoogleMaps1");
 if (mapObjGoogleMaps1 != 'undefined' && mapObjGoogleMaps1 != null) {

            var mapOptionsGoogleMaps1 = {
                zoom: 1,
                panControl: false,
                zoomControl: true,
                scaleControl: false,
                streetViewControl: false,
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                mapTypeControl: false,
                mapTypeControlOptions: {style:     google.maps.MapTypeControlStyle.DEFAULT}
            };

                mapOptionsGoogleMaps1.center = new      google.maps.LatLng(
                    29.307260,
                    48.031880
                );

            mapGoogleMaps1 = new google.maps.Map(mapObjGoogleMaps1,mapOptionsGoogleMaps1);
        var point = new google.maps.LatLng(29.3058981,48.0315399);
markersGoogleMaps1.push(createMarker(mapGoogleMaps1, point,"My HO","<p class=\"fl\">My Construction Co. <br \/>P.O. Box 44642-32060 <br \/>Hawali, Kuwait. <br \/>Tel : 22621711<\/p>", iconGoogleMaps1['uploads\GoogleMaps\markers\m_28_orangepng'].image, '', "sidebar_GoogleMaps1", '' ));


          }
}

       function createMarker(map, point, title, html, icon, icon_shadow, sidebar_id, openers){
            var marker_options = {
                position: point,
                map: map,
                title: title};  
            if(icon!=''){marker_options.icon = icon;}
            if(icon_shadow!=''){marker_options.shadow = icon_shadow;}
            //create marker
            var new_marker = new google.maps.Marker(marker_options);
            if(html!=''){

                var infowindow = new google.maps.InfoWindow({content: html});
                google.maps.event.addListener(new_marker, 'mouseover', function() {
                  infowindow.open(map,new_marker);
                });
                if(openers != ''&&!isEmpty(openers)){
                   for(var i in openers){
                     var opener = document.getElementById(openers[i]);
                     opener.onmouseover = function(){infowindow.open(map,new_marker); return false};
                   }
                }

                if(sidebar_id != ''){
                    var sidebar = document.getElementById(sidebar_id);
                    if(sidebar!=null && sidebar!=undefined && title!=null && title!=''){
                        var newlink = document.createElement('a');

                        newlink.onclick=function(){infowindow.open(map,new_marker); return false};

                        newlink.innerHTML = title + ' ';
                        sidebar.appendChild(newlink);
                    }
                }
            }
            return new_marker;  
        }
    function isArray(a) {return isObject(a) && a.constructor == Array;}
function isObject(a) {return (a && typeof a == 'object') || isFunction(a);}
function isFunction(a) {return typeof a == 'function';}
function isEmpty(obj) { for(var i in obj) { return false; } return true; }
//]]>
</script>
4

1 に答える 1

0

なぜバックスラッシュを使用しているのですか?

iconGoogleMaps1['uploads\GoogleMaps\markers\m_28_orangepng'].image =  new google.maps.MarkerImage('http://localhost/sites/sinmar\uploads\GoogleMaps\markers\m_28_orange.png',

おそらく代わりにスラッシュが必要です。

于 2013-06-06T12:52:19.207 に答える