谷歌地图说未定义的谷歌,而它在aspx页面上

Google Map says undefined google while it is on aspx page

本文关键字:aspx 未定义 谷歌 谷歌地图      更新时间:2023-09-26

当我在简单的html文件(项目外 - 本地)上测试它时,它可以工作,但是当我在aspx页面上的项目中使用此代码时,它找不到"google"。我该如何解决它?这是我使用的代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Map</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<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?sensor=false">  
</script>
<script type="text/javascript">
    function initialize() {
        var latlng = new google.maps.LatLng(-34.397, 150.644);
        var myOptions = {
            zoom: 8, center: latlng, mapTypeId:
google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
    }
   </script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width: 100%; height: 100%">
</div>
</body>
</html>

脚本标记中的http:''更改为http://