我有这个自定义谷歌地图,从SQL服务器读取动态标记,
它在chrome上工作正常
,但是在使用IE时,它会让我对此文件https://maps.gstatic.com/intl/en_us/mapfiles/api-3/15/8/main.js
出错错误发生在main.js,第25行字符911,堆栈空间不足 ....
此外,我正在使用谷歌地图标记群集。
此处是指向问题http://aprilit.com/gmap/default.aspx
的网站的链接我被困住了,不知道该怎么办,请帮助..
这是我的js文件,它调用json并在地图上列出标记
var map;
函数LoadMap(arrMarkers){
var mapOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false } var MarkerShadow = new google.maps.MarkerImage('img/assets/markershadow.png', new google.maps.Size(51.0, 37.0), new google.maps.Point(0, 0), new google.maps.Point(16.0, 18.0)); var MarkerShape = { coord:
[20,0,21,1,22,2,23,3,24,4,25,5,25,6,25,7,25,8,25,9,25,10,25, 11,25,12,25,13,25,14,24,15,23,16,23,17,22,18,20,19,21,20,24,21,27,22,29,23, 30,24,30,25,26,26,29,27,29,28,27,29,24,30,21,31,13,31,12,30,12,29,12,28,11, 27,11,26,11,25,11,24,11,23,12,22,12,21,11,20,10,19,9,18,8,17,7,16,6,15, 6,14,5,13,5,12,5,11,5,10,5,9,5,5,5,7,5,6,6,5,6,4,7,8,8, 2,9,11,1,0,20,0], 类型:'poly' };
var map = new google.maps.Map(document.getElementById('map'), mapOptions); var markers = []; var tempCount = 0; var bounds = new google.maps.LatLngBounds(); for (var XMLCount = 0; XMLCount < arrMarkers.length; XMLCount++) { var Points = $.parseXML(arrMarkers[XMLCount]); $Markers = $(Points).find("Marker"); for (var i = 0; i < $Markers.length; i++) { var tempID = $Markers.find('mid')[i].innerHTML; var tempCID = $Markers.find('cid')[i].innerHTML; var myLatLng = new google.maps.LatLng($Markers.find('lt')[i].innerHTML, $Markers.find('lg')[i].innerHTML); markers.push(new google.maps.Marker({ position: myLatLng, map: map, animation: google.maps.Animation.DROP, shadow: MarkerShadow, shape: MarkerShape, markerid: $Markers.find('mid')[i].innerHTML, catid: $Markers.find('cid')[i].innerHTML, icon: LoadIcon($Markers.find('cimg')[i].innerHTML) })); infowindow = new google.maps.InfoWindow({ content: "loading..." }); google.maps.event.addListener(markers[tempCount], 'click', function () { infowindow.setContent('<div style="font-family:tahoma;font-size:10pt;height:30px;"><img
SRC = “IMG /资产/ loader.gif”/&GT;中..');
infowindow.open(map, this); $.ajax( { type: "POST", contentType: "application/json; charset=utf-8", url: "Markers.asmx/GetMarker", data: JSON.stringify({ MarkerID: this['markerid'], CategoryID: this['catid'] }), //{conType:"'"
+ ContentType +“'”,conID:“'”+ ContentID +“'”},// dataType:“json”, 成功:功能(msg){
infowindow.setContent(formatInfoDivHTML(msg.d)); } }); map.panTo(this.getPosition()); infowindow.open(map, this); }); bounds.extend(myLatLng); tempCount++; } } map.fitBounds(bounds); var mcOptions = { gridSize: 50, maxZoom: 12 }; var markerCluster = new MarkerClusterer(map, markers, mcOptions); google.maps.event.trigger(map, 'resize'); } function LoadIcon(MarkerImage) { var ImagePath = "Images/Categories/" + MarkerImage; var image = new google.maps.MarkerImage(ImagePath, new google.maps.Size(32.0, 37.0), new google.maps.Point(0, 0), new google.maps.Point(16.0, 18.0)); return image; }
function formatInfoDivHTML(xmlMarker){
var Marker = $.parseXML(xmlMarker); var ImagePath = "Images/Marker/" + $(Marker).find('mimg')[0].innerHTML; var URL = "ViewMarker.aspx?id=" + $(Marker).find('mid')[0].innerHTML; ; var html = "<div style='font-family:tahoma;font-size:10pt;'>"; html += "<img style='width:100px;height:100px;margin:1px 6px 0 0;border:1px solid #ccc;float:left;padding:1px;' src='" + ImagePath +
“'/&gt;”;
html += "<strong style='font-size:12pt;'>" + $(Marker).find('t')[0].innerHTML + "</strong><br/><br/>"; html += "<p style='margin-left:6px;'>" + $(Marker).find('intr')[0].innerHTML + "</p><br/>"; html += "<a href='" + URL + "'> View Details</a><br/>"; html += "</div>"; return html; } function LoadMarkers(CatID) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "Markers.asmx/GetMarker", data: JSON.stringify({ MarkerID: -1, CategoryID: CatID }), dataType: "json", success: function (msg) { if (msg.d != "") LoadMap(SplitXML(msg.d)); else alert("No Markers related to this category!"); } }); } function SplitXML(xmlstring) { xmlstring = xmlstring.replace(/<Markers>/g, ""); xmlstring = xmlstring.replace(/<\/Markers>/g, ""); xmlstring = xmlstring.replace(/<\/Marker>/g, "#"); var xmlMarkers = xmlstring.split('#'); var markersXMLArr = []; var xmlCollection = "<Markers>"; var j = 1; for (var i = 0; i < xmlMarkers.length; i++) { if (xmlMarkers[i] != '') { xmlCollection += xmlMarkers[i] + '</Marker>'; } if (j < 5 && i != xmlMarkers.length - 1) { j++; } else { markersXMLArr[parseInt(i / 5)] = xmlCollection + "</Markers>"; j = 1; xmlCollection = "<Markers>"; } } return markersXMLArr; }
地图征集将如下
LoadMarkers(-1);
感谢
答案 0 :(得分:0)
我解决了这个问题,
IE似乎不支持我在这里使用的innerHTML属性:
$ Markers.find( 'MID')[I] .innerHTML
或我从xml字段中检索数据的任何其他地方。
因此必须将textContent属性替换为:
$ Markers.find( 'MID')[I] .textContent;
这解决了整个问题。!!
感谢您的帮助