大佬教程收集整理的这篇文章主要介绍了jquery – “未捕获的TypeError:无法在’Window’上执行’getComputedStyle’:参数1的类型不是’Element’.Tq @ VM107:37mF,当gmap添加时,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
html标记是:
<type="submit" id="locate">Find me</button> <div id="gmap"> </div> enter code here $(document).ready(function () { $('#locate').on('click',function (E) { e.preventDefault(); if (navigator.geoLOCATIOn) { navigator.geoLOCATIOn.getCurrentPosition(showPosition); } else { console.log('GeoLOCATIOn is not supported by your browser'); } }); var latlng,mapOptions,map; showPosition = function (position) { latlng = new google.maps.LatLng(position.coords.latitude,position.coords.longitudE) mapOptions = { center: latlng,mapTypEID: google.maps.MapTypEID.roaDMAP,zoom: 15 } Map = new google.maps.Map($('#gmap'),mapOptions); var marker = new google.maps.Marker({ position: latlng,map: map,title: "You are here" }) } });
> JavaScript区分大小写,这一行:
@H_159_6@map = new google.maps.Map应该
@H_159_6@map = new google.maps.Map(注意开头的地图中的小写m.)
那么为什么你没有得到“未定义的变量”错误或什么?因为The Horror of Implicit Globals.请考虑使用strict mode,以便您获得主动通知.
> google.maps.Map构造函数希望你给它一个元素作为它的第一个参数,但你不是这样做的.你给它一个jQuery对象:
以上是大佬教程为你收集整理的jquery – “未捕获的TypeError:无法在’Window’上执行’getComputedStyle’:参数1的类型不是’Element’.Tq @ VM107:37mF,当gmap添加时全部内容,希望文章能够帮你解决jquery – “未捕获的TypeError:无法在’Window’上执行’getComputedStyle’:参数1的类型不是’Element’.Tq @ VM107:37mF,当gmap添加时所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。