我有以下代码来显示我的主页。但在我的网页上,它只显示了我所在的城市。虽然我使用了正确的海拔高度和经度,但它并没有具体显示我的位置;
我想要这样;
我想要图像
但现在它是这样的;
现在图像
这是我的密码;
<html>
<head>
<script src="http://maps.googleapis.com/maps/api/js">
</script>
<script>
function initialize(){
var mapProp = {
center:new google.maps.LatLng(6.2422975,80.0603382),//latitude and longitude respectively
zoom:13,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize)
</script>
</head>
<body>
<div id="googleMap" style="width:680px;height:400px;"> </div>
</body>
您正在定义映射,但没有定义映射的标记。
https://developers.google.com/maps/documentation/javascript/markers