English 中文(简体)
OpenLayers + Ajax: 错误或错误
原标题:OpenLayers + Ajax: bug or mistake

我使用下面的密码在 < code> OpenLayers < /code> 容器中演示 < code> OpenLayers 映射。 我不知道为什么我必须重新打开网页好几次才能看得见地图。 这不是互联网连接速度的问题。 我只需要点击几个jquery 标签, 最后在指定的标签中打开地图。 的确没有生成错误信息。 它出现在 Chrome 和 Firefox 中。 我不知道它是否是一个错误或错误 。

十分感谢任何建议。

<强度 > mainPage.php

    <script type="text/javascript">
      $(document).ready(function() {
            $("#tabs").tabs({
            ajaxOptions: {
                success: function( html ) {
                    $("#content").html(html);;
                }
            }
        });
      });           
    </script>
<div id="tabs">
    <ul>
        <li><a href="administration.php"><span>Administration</span></a></li>
        <li><a href="map.php"><span>Map</span></a></li>
    </ul>
</div>

< 强度 > map.php

<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
    map = new OpenLayers.Map("basicMap");
    map.addLayer(new OpenLayers.Layer.OSM());       
    var points = new OpenLayers.Layer.Text( "Resource Locations",
                    { location: "dataLonLat.php",
                      projection: map.displayProjection
                   });
    map.addLayer(points);

    var geographic = new OpenLayers.Projection("EPSG:4326");
    var mercator = new OpenLayers.Projection("EPSG:900913");

    //Set start centrepoint and zoom 
    var lonLat = new OpenLayers.LonLat(2.07632,41.30408)
          .transform(
            geographic, // transform from WGS 1984
            mercator // to Spherical Mercator Projection
          );
    var zoom=16;
    map.setCenter (lonLat, zoom);  

  </script>

<div id="basicMap" style="width: 100%; height: 100%;">
</div>
问题回答

I think your script «map» script is evaluated before #basicMap is add to the page. In map.php, try to put your #basicMap first and your script tags after.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签