Javascript - get latitude&经度和不同地方的时区价值 [英] Javascript - get latitude & longitude & time zone value for different places

查看:59
本文介绍了Javascript - get latitude&经度和不同地方的时区价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Praytimes JS源(http://praytimes.org/code/v2/js/PrayTimes.js)来显示穆斯林祈祷时间但是对于每个位置我必须手动添加纬度和放大器;那个位置的经度。



我怎样才能得到纬度&使用API​​密钥的经度和时区(例如:+4)值或添加地点只需键入地名以获得该地点的祈祷时间,所以

我想知道1-如何做我手动添加城市2-如何将程序链接到以下代码的API位置:

I am using Praytimes JS source(http://praytimes.org/code/v2/js/PrayTimes.js) to display Muslim prayer times but for each location I have to manually add latitude & longitude of that location.

how can I get latitude & longitude and time zone (example: +4) values using API key or to add places in so just to type place name to get prayer time for that place, so
I want to know 1- how do I add cities manually 2- how to link the program to API places for below codes:

<script type="text/javascript">
prayTimes.setMethod('MWL'); 
var date = new Date(); // today
var times = prayTimes.getTimes(date, [23.022505, 72.5713621]);
var list = ['Fajr', 'Sunrise', 'Dhuhr', 'Asr', 'Maghrib', 'Isha', 'Midnight'];

var html = '<table id="timetable">';
html += '<tr><th colspan="2">'+ date.toLocaleDateString()+ '</th></tr>';
for(var i in list) {
    html += '<tr><td>'+ list[i]+ '</td>';
    html += '<td>'+ times[list[i].toLowerCase()]+ '</td></tr>';
}
html += '</table>';
document.getElementById('table').innerHTML = html;





我尝试过:



< select id =citiessize =1style =font-size:12px; onchange =getValues()>

< option value =52.379189:4.899431:+2selected =selected> Amsterdam< / option>

< option value =33.45:-112.06:-2> Phoenix< / option>

< option value =40.748817:-73.985428:+4> New York< / option> ;



< / select>



What I have tried:

<select id="cities" size="1" style="font-size: 12px;" onchange="getValues()">
<option value="52.379189:4.899431:+2" selected="selected">Amsterdam</option>
<option value="33.45:-112.06:-2">Phoenix</option>
<option value="40.748817:-73.985428:+4">New York</option>

</select>

推荐答案

参见地点:Google地图平台 [ ^ ]


这篇关于Javascript - get latitude&amp;经度和不同地方的时区价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆