2023如何使用HTML5地理定位或Google API获取地址的经纬度?

 所属分类:web前端开发

 浏览:49次-  评论: 0次-  更新时间:2023-10-07
描述:更多教程资料进入php教程获得。 为了使用 HTML5 地理位置或任何 Google API 获取纬度和经度,我们需要为此添加 JavaScript。 ...
更多教程资料进入php教程获得。

如何使用HTML5地理定位或Google API获取地址的经纬度?

为了使用 HTML5 地理位置或任何 Google API 获取纬度和经度,我们需要为此添加 JavaScript。

脚本如下 -

if (navigator.geolocation) {

   /*  If current position is obtained then there is success otherwise there is failure.
   On failure, separate error message is shown  */    
   navigator.geolocation.getCurrentPosition(successFunc, errorFunc);
}  else {    
   alert(‘Geolocation is not enabled in your browser. Please use a latest browser to supports it.');
}
 标签:
积分说明:注册即送10金币,每日签到可获得更多金币,成为VIP会员可免金币下载! 充值积分充值会员更多说明»

讨论这个素材(0)回答他人问题或分享使用心得奖励金币

〒_〒 居然一个评论都没有……

表情  文明上网,理性发言!