AnyBody 可以帮助我。我陷入了谷歌地图 v3 代码中。当我使用谷歌标记对象设置标记图像时,它在浏览器窗口中出现错误未捕获的语法错误:意外令牌非法。我在图像标记字符串中更改了转义字符,但它不起作用。请帮帮我。
<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>