|
@@ -0,0 +1,198 @@
|
|
|
|
+<!DOCTYPE html>
|
|
|
|
+<html>
|
|
|
|
+<head>
|
|
|
|
+ <meta charset="utf-8">
|
|
|
|
+ <title>convert</title>
|
|
|
|
+</head>
|
|
|
|
+<body>
|
|
|
|
+
|
|
|
|
+ <input type="input" name="convert" id="convert">
|
|
|
|
+ <p><b></b></p>
|
|
|
|
+ <div id="params">
|
|
|
|
+ <input type="checkbox" name="option1" value="a1" id="i1">UAH
|
|
|
|
+ <input type="checkbox" name="option2" value="a2" id="i2">USD
|
|
|
|
+ <input type="checkbox" name="option3" value="a3" id="i3">CNY
|
|
|
|
+ <input type="checkbox" name="option4" value="a4" id="i4">CHF
|
|
|
|
+ <input type="checkbox" name="option5" value="a5" id='i5'>EUR
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <p><input type="button" name="btn" id="btn" value="Press" onclick="conv()"></p>
|
|
|
|
+
|
|
|
|
+ <div id="hid">
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <script>
|
|
|
|
+ function conv(){
|
|
|
|
+ if(i1.checked==true){
|
|
|
|
+ while (hid.hasChildNodes()) {
|
|
|
|
+ hid.removeChild(hid.firstChild);
|
|
|
|
+ }
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/UAH')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='USD: '+'$'+data.rates.USD*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/UAH')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CNY: '+data.rates.CNY*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/UAH')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CHF: '+data.rates.CHF*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/UAH')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='EUR: '+Number(data.rates.EUR).toFixed(3)*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if(i2.checked==true){
|
|
|
|
+ while (hid.hasChildNodes()) {
|
|
|
|
+ hid.removeChild(hid.firstChild);
|
|
|
|
+ }
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/USD')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='UAH: '+'$'+data.rates.UAH*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/USD')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CNY: '+data.rates.CNY*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/USD')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CHF: '+data.rates.CHF*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/USD')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='EUR: '+Number(data.rates.EUR).toFixed(3)*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if(i3.checked==true){
|
|
|
|
+ while (hid.hasChildNodes()) {
|
|
|
|
+ hid.removeChild(hid.firstChild);
|
|
|
|
+ }
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CNY')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='UAH: '+'$'+data.rates.UAH*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CNY')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='USD: '+data.rates.USD*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CNY')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CHF: '+data.rates.CHF*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CNY')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='EUR: '+Number(data.rates.EUR).toFixed(3)*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if(i4.checked==true){
|
|
|
|
+ while (hid.hasChildNodes()) {
|
|
|
|
+ hid.removeChild(hid.firstChild);
|
|
|
|
+ }
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CHF')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='UAH: '+'$'+data.rates.UAH*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CHF')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CNY: '+data.rates.CNY*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CHF')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='USD: '+data.rates.USD*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/CHF')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='EUR: '+Number(data.rates.EUR).toFixed(3)*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if(i5.checked==true){
|
|
|
|
+ while (hid.hasChildNodes()) {
|
|
|
|
+ hid.removeChild(hid.firstChild);
|
|
|
|
+ }
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/EUR')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='UAH: '+'$'+data.rates.UAH*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/EUR')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CNY: '+data.rates.CNY*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/EUR')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='CHF: '+data.rates.CHF*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ fetch('https://open.er-api.com/v6/latest/EUR')
|
|
|
|
+ .then(r=>r.json())
|
|
|
|
+ .then(data=>{
|
|
|
|
+ let p=document.createElement('p');
|
|
|
|
+ p.innerHTML='USD: '+Number(data.rates.USD).toFixed(3)*convert.value;
|
|
|
|
+ hid.append(p);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //let urls=['UAH','USD','CNY','CHF','EUR'];
|
|
|
|
+ </script>
|
|
|
|
+</body>
|
|
|
|
+</html>
|