TypeError: google.maps.latLng不是构造函数
TypeError: google.maps.latLng is not a constructor
我正在使用Firefox加载我的GeoLocation html文件。问题是我在控制台中得到了这两条消息:
TypeError: google.maps.latLng is not a constructor index.html:26
error in parsing value for 'background'. Declaration dropped.
下面是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Navigator</title>
</head>
<script src="js/jquery.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script>
x = navigator.geolocation;
x.getCurrentPosition(success, failure);
function success(position) {
// fetch coordinates
var mylat = position.coords.latitude;
var mylong = position.coords.longitude;
// google api ready latitude and longitude string
var coords = new google.maps.latLng(mylat, mylong);
// setting up out google map
var mapOptions = {
zoom: 16,
center: coords,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
// CREATING MAP
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
}
function failure() {
$('#lat').html("<h3> No co-ordinates available!</h3>");
}
</script>
<body>
<!--map placeholder -->
<div id="map">
</div>
<div id="lat"></div>
<div id="long"></div>
</body>
</html>
我甚至不确定从谷歌地图API加载正确的数据。有人能帮我解决这个问题吗?
TypeError: google.maps.latLng不是构造函数
google.maps.LatLng
用代替
google.maps.Latlng.
就这些,在Google地图上运行得很好
相关文章:
- ES6构造函数返回基类的实例
- 使用Google Visualization动态调用构造函数
- javascript中对象构造函数中的var属性与this.properties
- 理解typescript中的构造函数接口
- 为什么构造函数不是构造函数
- 如果在构造函数中有“返回”,则在 JavaScript 中的新运算符中做了什么
- 拦截对构造函数的调用
- 使用闭包共享构造函数参数
- 文本表示法VS.构造函数,用于在JavaScript中创建对象
- 从js引擎的角度来看闭包和构造函数是如何工作的
- 如何使用此从对象访问构造函数
- Javascript:为什么是构造函数's __proto__属性Empty(){}
- 当一个重要的构造函数参数丢失时应该发生什么
- Chrome Javascript日期构造函数错误
- 如何使用构造函数's的输出,以便将值插入到对象中
- 为什么在调用父构造函数时在[]中发送数据
- 构造函数函数闭包变量
- ES6类是否与构造函数相同
- 构造函数中的事件处理程序与构造函数外的事件处理函数的行为不同
- TypeError: google.maps.latLng不是构造函数