-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEjercicio 11.html
More file actions
35 lines (30 loc) · 796 Bytes
/
Ejercicio 11.html
File metadata and controls
35 lines (30 loc) · 796 Bytes
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
<!DOCTYPE html>
<html lang=en dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<script>
function alquiler_coche(precio){
var valorDevuelto = precio * 40;
if(precio >= 7){
valorDevuelto -= 50;
}else if(precio >= 3){
valorDevuelto -= 20
}
return valorDevuelto;
}
function calcular_coste(){
var alquiler = document.getElementById("alquiler").value;
var resultado = alquiler_coche(alquiler)
document.getElementById("alquiler_de_coche").value = resultado;
}
</script>
</head>
<body>
<label>Días de alquiler del coche:</label>
<input id="alquiler" type="text">
<input onclick="calcular_coste()" value="calcular coste" type="button">
<br><br>
<label>Coste alquiler coche: </label><input id="alquiler_de_coche" type="text"><br>
</body>
</html>