映射dosent's也出现在标记中
the map dosent's appear also the marker
我想要的是有一张地图,当我在某个位置设置标记时,我会得到它的纬度和经度。。。请告诉我我的代码出了什么问题??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>geoloaction</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
$(function(){
var latlng=new google.maps.LatLng(35.6771389,10.0972400);
var map=new google.maps.Map(document.getElementById('gmap'),{
zoom:13,
center:latlng,
mapTypeld:google.maps.MapTypeld.ROADMAP });
var marker=new google.maps.Marker({
position:latlng,
map:map,
title:'bougez ce cuseur' ,
draggable: true });
var geocoder=new google.maps.Geocoder();
google.maps.event.addListener(marker,'drag',function(){
setPosition(marker); });
return false; });
function setPosition(marker){
var pos=marker.getPosition();
$(document.getElementById('Lat')).val(pos.lat());
$(document.getElementById('Lng')).val(pos.lng());
}
</script>
</head>
<body>
<div id="gmap" style="width:100%;height:400px;"></div>
</body>
以下是解决方案https://jsfiddle.net/m97o308u/
不是MapTypeld
而是MapTypeId
您应该将此行mapTypeld:google.maps.MapTypeld.ROADMAP
更改为mapTypeId:google.maps.MapTypeId.ROADMAP
相关文章:
- 如何在映射数组中添加换行符
- ng映射方向备选方案
- 无法通过数组映射绑定
- ReactJS映射:如何仅在url变量不为空时呈现html链接
- 使用Scala Play Framework视图中的键检索映射值
- 淘汰映射;不起作用
- 映射数组ES6时考虑空值
- Lodash映射并返回唯一
- 如何对映射插件创建的敲除对象进行深度复制
- 在javascript中按映射中的值排序
- 使用带有两个参数的函数的javascript映射
- 在内部映射值时渲染方法中断
- JSON:获取映射数据
- HTML Dropdownlist未映射到MVC模型
- 使用Google Maps JavaScript API v3和Geocoding API映射多个位置
- immutable.js与嵌套映射/对象的比较/相等性能
- 从映射返回React渲染数组
- 使用Google'设置ID属性;s映射API
- 使用Browserify和Typescript的源映射进行Webstorm调试
- 映射dosent's也出现在标记中