我正在尝试使用web2py的页面呈现多个自定义标记
框架和我的地图将无法渲染。我看到使用chrome的调试器
两个错误,一个是“未捕获到的SyntaxError:意外令牌第二个说“未捕获的ReferenceError:初始化不是
确定”。在确定我在做什么方面,我将不胜感激
错误。

这是指向我的网站http://roamweb.sanren.ac.za/的链接。

我的代码副本粘贴在下面。

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
    <!--  <style type="text/css">
    html { height: 100% }
    body { height: 100%; margin: 0px; padding: 0px }
    #map_canvas { height: 100% }
    </style> -->

    <script type="text/javascript"
    src="http://maps.google.com/maps/api/js?v=3key={{=GOOGLEMAP_KEY}}&sensor=false">
    </script>
    <script type="text/javascript"> <![CDATA[
       function initialize() {
       var myOptions = {
       center: new google.maps.LatLng(-28.401065, 25.312500),
       zoom: 6,
       mapTypeId: google.maps.MapTypeId.ROADMAP
   };

       var map = new google.maps.Map(document.getElementById('map_canvas'),options);

       function createMarker(point, i, message) {
         if(i==0) google.maps.MarkerOptions = {
           {{for row in rows:}}{{if row.latitude and row.longitude:}}
           var point = new google.maps.LatLng({{=row.latitude}},{{=row.longitude}});
           var message = '{{=str(row.plugin_gmap_popup).replace("'","\\'")}}'
           var myicon = new google.maps.MarkerImage('http://roamweb.sanren.ac.za/db/static/Icon-wifi.png', null, null, new google.maps.Point(9,34), new google.maps.Size(37,34));
           var marker = new google.maps.Marker({
           position: point;
           icon: myicon;
           title: 'click me for info';
           )};
       };
       else google.maps.MarkerOptions = {};
       var infoWindow = new google.maps.InfoWindow({
         content:message
       )};
       google.maps.event.addListener(marker, 'click', function() {
           infoWindow.open(map, marker)
       });

       marker.setMap(map);
   };

       createMarker(point, 0, message);

       {{pass}}{{pass}}
 }
]]>

    </script>
    </head>
    <body onload="initialize()">
       <div id="map_canvas" style="width: {{=width}}px; height:{{=height}}px"></div>
    </body>
    </html>

最佳答案

尝试更正CDATA

<script type="text/javascript">
//<![CDATA[
...
//]]>
</script>

关于javascript - 未捕获的ReferenceError:未定义初始化,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9597653/

10-09 21:11