-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
97 lines (46 loc) · 1.6 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
function windspeed()
{
var input1=document.getElementById('city').value;
console.log(input1);
fetch('https://api.openweathermap.org/data/2.5/weather?q='+input1+'&appid=546b320f391c831f79f4796be03fab6f').then(response => response.json())
.then(data => {
var wind1speed=data.wind.speed*(3.6);
console.log(wind1speed);
var winddir=data.wind.deg;
var p=document.getElementById('ws');
p.innerHTML="<span> The WINDSPEED of city "+ input1 +" is </span>"+wind1speed.toFixed(3)+" KMPH, in the Metrological Direction "+winddir;
});
}
function temprature()
{
var input1=document.getElementById('city').value;
console.log(input1);
fetch('https://api.openweathermap.org/data/2.5/weather?q='+input1+'&appid=546b320f391c831f79f4796be03fab6f').then(response => response.json())
.then(data => {
var wind1speed=data.main.temp-273.15;
var p=document.getElementById('tp');
p.innerHTML="<span> The TEMPERATUR of city "+ input1 +" is </span>"+wind1speed.toFixed(2)+"°C.";
});
};
function windpower()
{
var input1=document.getElementById('city').value;
if(input1>=12)
{
var p=document.getElementById('ws');
p.innerHTML="<span> The PREDICTION OF POWER IS 3500 kw (kilowatt) </span>";
}
else if(input1<3)
{
var p=document.getElementById('ws');
p.innerHTML="<span> The PREDICTION OF POWER IS 0 kw (kilowatt) </span>";
}
else
{
var m=283.40;
var z=m*input1-834.4;
z = z.toFixed(7);
var p=document.getElementById('ws');
p.innerHTML="<span> The PREDICTION OF POWER IS " + z +" kw (kilowatt) </span>";
}
}