这是我的javaScript代码。Google地图更改不会在浏览器中呈现
(function() {
window.onload = function() {
// Creating a reference to the mapDiv
var mapDiv = document.getElementById('map');
// Creating a latLng for the center of the map
var latlng = new google.maps.LatLng(37.09, -95.71);
// Creating an object literal containing the properties
// we want to pass to the map
var options = {
center: latlng,
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
// Creating the map
var map = new google.maps.Map(mapDiv, options);
}
})();
当我加入disableDefaultUI:真实变量的选择和测试它在我的浏览器(歌剧,火狐,Chrome Canary版)它不会禁用UI。我目前在我的Mac OSX 10.6.8版本上使用Eclipse Indigo。我的浏览器缓存有问题吗?我的代码似乎没问题。我不明白为什么它不会在浏览器上呈现。
var options = {
zoom: 3,
center: new google.maps.LatLng(37.09, -95.71),
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
我在我的html文档中引用javascript文件时犯了一个错误。愚蠢的错误。 –