日期:2014-05-17  浏览次数:20446 次

SOSO地图添加多个HTML信息!!!急急急!!!100分
我用的是ASP.NET开发环境,使用的是SOSO的JSAPI代码如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SOSOMap</title>
<style type="text/css">
*{
    margin:0px;
    padding:0px;
}
body, button, input, select, textarea {
    font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
}
#info {
    margin-top: 10px;
}
</style>
<script charset="utf-8" src="http://api.map.soso.com/v1.0/main.js"></script>

<script>
var init = function() {
    var center = new soso.maps.LatLng(41.804363,123.434025);
    var map = new soso.maps.Map(document.getElementById('container'),{
        center: center,
        zoomLevel: 13
    });
    var infoWin = new soso.maps.InfoWindow({
        map: map
    });
    
     var latlngs = 
    [
        new soso.maps.LatLng(41.818263,123.436471),
        new soso.maps.LatLng(41.808109,123.505062),
        new soso.maps.LatLng(41.765456,123.229978),
        new soso.maps.LatLng(41.868836,123.416949),
        new soso.maps.LatLng(41.707407,123.482924)
    ];
    
     for(var i = 0;i < latlngs.length; i++) 
     {
        (
            function(n){ infoWin.open('<div style="width:100px">'+ i +'</div>', latlngs[i]); }
        )
        (i);
     }
}
</script>

</head>
<body onload="init()">
    <div style="width:1000px;height:600px" id="container"></div>
    <div id="info">
    <p>调用open方法打开一个信息窗,内容为一张图片和一段文字。</p>
</div>
</body>
</html>

为什么在循环结束后地图上只显示最后一次循环的HTML信息,之前的都没有显示出来啊
SOSO地图?API