-
Notifications
You must be signed in to change notification settings - Fork 0
/
sre.js
83 lines (51 loc) · 1.86 KB
/
sre.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
const buttom = document.getElementById('converter button')
const select = document.getElementById('palmeiras')
const dolar = 5.2
const euro2 = 5.9
const bct32 = 315.32363
const convertValue = () => {
const inpuntr = document.getElementById("real").value
const realValue = document.getElementById('real-value')
const currenValue = document.getElementById('curren-value')
realValue.innerHTML = new Intl.NumberFormat('pt-BR', {
style: 'currency',
currency: 'BRL',})
.format( inpuntr)
if (select.value === "US$ Dólar americano") {
currenValue.innerHTML = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',})
.format( inpuntr / dolar)
}
if (select.value === "€ Euro") {
currenValue.innerHTML = new Intl.NumberFormat('de-DE', {
style: 'currency',
currency: 'EUR',})
.format( inpuntr / euro2)
}
if (select.value === "BTC Bitcoin") {
currenValue.innerHTML = new Intl.NumberFormat('BTC', {
style: 'currency',
currency: 'BTC',})
.format( inpuntr / bct32 )
}
}
mudar =() =>{
const euroName = document.getElementById("euro-name")
const currentimg = document.getElementById("libertadoes")
if (select.value === '€ Euro') {
euroName.innerHTML = " Euro"
currentimg.src ="euro1.png"
}
else if (select.value === 'US$ Dólar americano') {
euroName.innerHTML = " Dólar americano"
currentimg.src = "estados-unidos (1) 11 (1).jpg"
}
else{
euroName.innerHTML = " BTC Bitcoin"
currentimg.src = "de.png"
}
convertValue()
}
buttom.addEventListener('click' , convertValue)
select.addEventListener("change", mudar)