IFCD0210/Practicas/Practicas JS/Eventos 01/js/main.js
Marcos Lopez ad40171fb4 Dia 32
2024-01-22 13:46:08 +01:00

54 lines
1.7 KiB
JavaScript

function eurToDolar(){
let eurosInput = document.getElementById('eurosInput');
let dolarOutput = document.getElementById('dolarOutput');
resultado = parseFloat(eurosInput.value)*1.09;
dolarOutput.value=resultado.toFixed(2);
}
function dolarToEur(){
let dolarInput = document.getElementById('dolarInput');
let eurOutput = document.getElementById('eurOutput');
resultado = parseFloat(dolarInput.value)*0.9;
eurOutput.value=resultado.toFixed(2);
}
function pvpIVA(){
let pvpInput=document.getElementById('pvpInput');
alert(pvpInput.value*1.21)
}
function frase() {
let nombre = document.getElementById('nombre').value;
let apellidos = document.getElementById('apellidos').value;
let nacimiento = document.getElementById('nacimiento').value;
let ciudad = document.getElementById('ciudad').value;
let frase =document.getElementById('frase');
frase.innerHTML= (`Hola ${nombre} ${apellidos} nacido el año ${nacimiento} en ${ciudad} <br>`)
}
function convertGC(){
let tempC=parseFloat(document.getElementById('gc').value)
let fahrenheit = (tempC*9/5)+32;
let kelvin = tempC + 273.15;
document.getElementById('gf').value=fahrenheit
document.getElementById('gk').value=kelvin
}
function convertGF(){
let tempF=parseFloat(document.getElementById('gf').value)
let celsius = (tempF-32)*5/9
let kelvin = celsius + 273.15;
document.getElementById('gc').value=celsius
document.getElementById('gk').value=kelvin
}
function convertGK(){
let tempK=parseFloat(document.getElementById('gk').value)
let celsius = tempK - 273.15;
let fahrenheit = (celsius-32)*5/9;
document.getElementById('gc').value=celsius;
document.getElementById('gf').value=fahrenheit;
}