Compare commits

...

3 Commits

Author SHA1 Message Date
2c6311ad88 add currencies 2020-06-18 23:16:47 +02:00
789e5b645f change html layout, better format number 2020-06-18 22:57:25 +02:00
cc70b38a21 translate english 2020-06-18 22:46:50 +02:00
2 changed files with 15 additions and 4 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="author" content="Arnau Busom i Vidal">
<title>Conversor</title>
<title>Currency Converter</title>
</head>
<body>
@ -13,6 +13,11 @@
<option value='SEK'>SEK</option>
<option value='JPY'>JPY</option>
<option value='GBP'>GBP</option>
<option value='INR'>INR</option>
<option value='ISK'>ISK</option>
<option value='DKK'>DKK</option>
<option value='RON'>RON</option>
<option value='NOK'>NOK</option>
</select>
<input type='number' id='val' step='0.01'>
@ -23,13 +28,19 @@
<option value='SEK'>SEK</option>
<option value='JPY'>JPY</option>
<option value='GBP'>GBP</option>
<option value='INR'>INR</option>
<option value='ISK'>ISK</option>
<option value='DKK'>DKK</option>
<option value='RON'>RON</option>
<option value='NOK'>NOK</option>
</select>
<button onClick='convert()'>Convert</button>
<p>
Quantitat convertida: <span id='res'></span>
Converted: <span id='res'></span>
</p>
<button onClick='convert()'>convertir</button>
<script src='script.js'></script>
</body>

View File

@ -13,5 +13,5 @@ async function convert(){
coef = 1;
}
var val = document.getElementById('val').value;
document.getElementById('res').textContent = val*coef + ' ' +document.getElementById('curr2').value;
document.getElementById('res').textContent = Number((val*coef).toFixed(2)).toLocaleString('en') + ' ' +document.getElementById('curr2').value;
}