为什么我的地图在一个页面上工作而在另一个页面上工作

时间:2012-09-21 18:25:31

标签: javascript google-maps

所以我在CodeIgniter框架中设置了Google地图。我有一个地图视图按钮,带我到地图,该地图加载很好,所有标记和一切。我想要完成的是从该页面获取基本地图并将其带到另一个页面并使其更小。听起来很简单!!好吧,当我将代码粘贴到新页面时,我从firebug获取所有这些错误消息。我猜测页面上运行的其他JavaScript导致了这些错误,但我不确定。我已粘贴下面的代码......

< ---------此代码在第一页上正常工作,所以我只想复制并粘贴到新页面----------->

<div class="domtab">
        <?php
        echo '<div class="large-box"; style="float:left; margin: 0.5cm 1cm 0.5cm 1cm; padding: 1em";>';
        ?>
        <div class="domtab">
        <link href="/intelligencegraph/resources/css/style.css" rel="stylesheet" type="text/css" />  
        <link href="/intelligencegraph/resources/css/developer.css" rel="stylesheet" type="text/css" />  
        <link href="/intelligencegraph/resources/css/thickbox.css" rel="stylesheet" type="text/css" />  
        <link href="/intelligencegraph/resources/css/jquery-ui.css" rel="stylesheet" type="text/css" />  
        <script type="text/javascript" src="/intelligencegraph/resources/uploads/entity_icons" ></script>

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCy38HO--LhhK-BS1WqIDrHXyFU9ljaRT4&sensor=false"></script>
<script type="text/javascript">
        <script type="text/javascript">                   
  // This loads the map, 
  function initialize() {
    var myLatlng = new google.maps.LatLng(<?php echo $node_address?>);
    var myOptions = {
      zoom: 10,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    // Adding a marker, to map
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    var marker = new google.maps.Marker({
      position: myLatlng, 
      map: map
      });        
  }



</script>
<body onload="initialize()">
<!-- Size Of map-->
<div id="map_canvas" style="height: 500px; width: 100%;"></div> 
        </div>  

        </div>
    </div>

&lt; ----------这是我认为干扰它的代码---------&gt;

<br style="clear: both;" /> 
<a onclick="document.getElementById('graphdb-viz').style.display = 'block'">View Visualization</a>

<div style="display: none" id="graphdb-viz">
    <iframe src="/intelligencegraph/viz/graph.jsp?nodeid=<?php echo $node_id ?>&database=<?php echo $database ?>" height="650" width="950"></iframe>
</div>


<a onclick="document.getElementById('graphdb-viz2').style.display = 'block'">View Alternative Visualization</a>

<div id="graphdb-viz2" style="height: 650px; width:950px; display: none" >
<script type="text/javascript" src="/intelligencegraph/resources/flash/swfobject.js"></script>
        <script type="text/javascript">
            // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. 
            var swfVersionStr = "10.2.0";
            // To use express install, set to playerProductInstall.swf, otherwise the empty string. 
            var xiSwfUrlStr = "playerProductInstall.swf";
            var flashvars = {nodeid:<?php echo $node_id; ?>,database:'<?php echo $database; ?>'};
            var params = {};
            params.quality = "high";
            params.bgcolor = "#ffffff";
            params.allowscriptaccess = "sameDomain";
            params.allowfullscreen = "true";
            var attributes = {};
            attributes.id = "GraphDBVis";
            attributes.name = "GraphDBVis";
            attributes.align = "middle";
            swfobject.embedSWF(
                "/intelligencegraph/resources/flash/GraphDBVis.swf", "flashContent", 
                "100%", "100%", 
                swfVersionStr, xiSwfUrlStr, 
                flashvars, params, attributes);
            // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
            swfobject.createCSS("#flashContent", "display:block;text-align:left;");
        </script>
        <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough 
             JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
             when JavaScript is disabled.
        -->
        <div id="flashContent" style="height: 2000px; width:2000px" >
        </div>


</div> 

&lt; ---------这里是所有错误消息---------&gt;

//"NetworkError: 404 Not Found - http://localhost:8091/resources/js/ckeditor/ckeditor_basic.js"

ckeditor_basic.js

"NetworkError: 404 Not Found - http://localhost:8091/resources/js/jquery.js"

jquery.js

"NetworkError: 404 Not Found - http://localhost:8091/resources/js/jquery-ui.js"

jquery-ui.js

"NetworkError: 404 Not Found - http://localhost:8091/resources/js/thickbox.js"

thickbox.js

"NetworkError: 404 Not Found - http://localhost:8091/intelligencegraph/resources/uploads/entity_icons/"

/intel..._icons/

"NetworkError: 404 Not Found - http://localhost:8091/resources/js/jquery-ui.js"

jquery-ui.js

"NetworkError: 404 Not Found - http://localhost:8091/resources/js/thickbox.js"

thickbox.js

"NetworkError: 404 Not Found - http://localhost:8091/intelligencegraph/resources/uploads/entity_icons/"

"NetworkError: 404 Not Found - http://mbostock.github.com/d3/d3.layout.js?2.6.0"

d3.lay...s?2.6.0

"NetworkError: 404 Not Found - http://mbostock.github.com/d3/d3.geom.js?2.6.0"

为什么我会在这个页面上获取它们而不是其他如果一切都相同?

1 个答案:

答案 0 :(得分:0)

这不适用于任何页面,你在这里有一个双脚本标记:

<script type="text/javascript">
        <script type="text/javascript">//<--causes a syntax-error, remove this line                
  // This loads the map,