简体   繁体   English

地理位置编码错误

[英]Error in coding on geolocation

what is wrong with this code? 此代码有什么问题? lines 2 and 7 apparently have errors? 第2和7行显然有错误吗? Thanks 谢谢

var location = Appery ('input').val();
if (location == '') {
   alert ('Please enter a location.');
   return;
}
var map = Appery('map');
map.options['address'] = location;
map.refresh();

You cant use name location for your variable! 您不能使用名称location作为变量!

The Window.location is read-only property, returns a Location object with information about the current location of the document. Window.location为只读属性,返回一个Location对象,其中包含有关文档当前位置的信息。

Change it to something different: 将其更改为其他内容:

var appery_loc = Appery('input').val();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM