<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&sensor=true">
</script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(0, 0),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
}
</script>
已添加这是 head.phtml
和
<script type="text/javascript">
jQuery(document).ready(function(){
initialize();
});
</script>
<div id="map_canvas" style="width:100%; height:100%;"></div>
把它放在我的phtml中
它似乎在 div 中放置了很多值,所以我知道脚本正在运行,但没有显示任何内容,谁能指出错误并指导我正确的方向???