XMod Pro - DotNetNuke - 谷歌地图

时间:2012-05-29 19:36:14

标签: javascript google-maps-api-3 dotnetnuke

我正在尝试使用最新的Google Maps API获取一些旧代码。但可能像大多数人提问一样,对Javascript没有经验,更不用说API了。      如果有人可以提供协助,我将非常感谢您帮助我们正常工作。感谢..

该模块是DNN的XMod Pro模块。这为您提供了许多选项,它是一个非常强大的模块,可以为您的网页等创建项目。不久前,有人发布了有关如何在XMod Pro中使用Google Maps API的信息。有关位置的纬度和长度信息来自人们输入有关位置信息的数据库。然后将标记放在地图上;这也是页面上的标准DIV。 XMod Pro使用双括号标记此数据库信息;例如[[Title]]为标题。

当有人点击位置标题的链接时,就是将他们带到地图上的该位置并向他们显示信息(再次来自 数据库)在弹出窗口中。这部分不起作用;也没有任何标记信息。

我认为问题出在JavaScript上,但究竟是什么导致了这些问题,我不知道。

以下是XMod Pro代码,大部分相关信息都存储在。再次感谢你..

    <headertemplate>
      <a name="HeaderTop"></a>
      <div width="150px" height="40px" style="color:black;background-
color:white;padding-bottom:10px;font-family:Georgia;font-size:
14px"><strong>Click an Item</strong></div>
    </headertemplate>
    <itemtemplate>
      <script type="text/javascript">
        var i = i + 1;
        x[i] = [[Lat]];
        y[i] = [[Long]];
        d[i] = '<table><tr><td>[[Title]]</td></
tr><tr><td>[[Description]]</td></tr><tr><td>[[Country]]</td></
tr><tr><td>[[Region]]</td></tr><tr><td>[[Email]]</td></tr></table>';
       document.write('<div style="padding-bottom:
8px;color:black;background-color:white" width="150px"
onclick="myGclick(' + i + ');">')
      </script>

      <strong>
      <table>
        <tr><td colspan="2"><a href="#HeaderTop"><div style="color:
#a41d21;font-size: 13px">[[Title]]</div></a></td></tr>
        <tr><td colspan="2">[[Description]]</td></tr>
        <tr><td>[[Country]]</td><td>[[Region]]</td></tr>
      </table>
      </div>

      <xmod:scriptblock scriptid="GoogleMapScripts"
registeronce="true" blocktype="ClientScript">
        <script src="http://maps.google.com/maps?
file=api&amp;v=2.x&amp;key=ABQIAAAAHrao_r7BKX4cQI0SxCQVHxRXbr2uTTbz5TwhEXAt1Cz65pgUPxQJAHBbHO1MuQeh5aRNkFOL-
Ozptw" type="text/javascript"></script>
        <script type="text/javascript">
          //<![CDATA[

           var map = null;
           var geocoder = null;
           var x=new Array()
           var y=new Array()
           var d=new Array()
           var myGclick = [];
           var gmarkers = [];

           // This function picks up the click and opens the corresponding info window
           myGclick = function myGclick(i) {
             GEvent.trigger(gmarkers[i], "click");
            }

          oldLoad = window.onload;
          window.onload = function load(){
            if(oldLoad){
             oldLoad();
            }
            if (GBrowserIsCompatible()) {
              var map = new GMap2(document.getElementById("map"));
              map.setCenter(new GLatLng(40, -98), 3);
              map.addControl(new GLargeMapControl());
              map.addControl(new GMapTypeControl());
              map.addControl(new GOverviewMapControl());

              // Creates a marker at the given point with the given number label
              function createMarker(point, d) {
                var marker = new GMarker(point);
                GEvent.addListener(marker, "click", function() {
                  marker.openInfoWindowHtml(d);
                 });
                 // save the info we need to use later for the side_bar
                gmarkers[i] = marker;
                return marker;
              }

              for (var i = 0; i < 999; i++) {
                var point = new GLatLng(x[i],
                          y[i]);
                 if ((x[i] == undefined)){break}
                map.addOverlay(createMarker(point, d[i]));
              }
 }
}
    //]]>
    </script>
    </xmod:scriptblock>

</itemtemplate>

    <footertemplate>

    </footertemplate>
    <noitemstemplate>
    <strong>nothing in table</strong>
    </noitemstemplate>

    <detailtemplate>
    </detailtemplate>

  </xmod:template>

1 个答案:

答案 0 :(得分:0)

它是否会在Inspector或Firebug中显示任何错误/消息?

在Google Maps API V5中,我的addMarker代码如下所示,我将infoWindow内容直接放入标记中。

function addMarker(map, latitude, longitude, heading, title, content){

        var latlong = new google.maps.LatLng(latitude, longitude);
        var markerOptions = {
        position: latlong,
        map: map,
        title: title,
        clickable: true,
        icon: 'marker.png',
    };

        //create marker object
        var marker = new google.maps.Marker(markerOptions);
        var infoWindowOptions = {
        content: content,
        position: latlong
    };

        //info window object
    var infoWindow = new google.maps.InfoWindow(infoWindowOptions);

        //add click event listener on marker, to bring up infoWindow
    google.maps.event.addListener(marker, "click",function(){
        infoWindow.open(map);
    });
}

当我处理这个时,我在这里使用了很多文档:developers.google.com/maps/documentation/javascript/overlays用于叠加层和标记

对不起,我不知道XMode Pro,但也许您可以注意到从旧API到新API的一些差异。

相关问题