-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsacarIniciales.html
43 lines (33 loc) · 1.12 KB
/
sacarIniciales.html
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
<!DOCTYPE html>
<html lang="es">
<!--
NOMBRE ARCHIVO: sacarIniciales.html
CREADOR: Isabel Ródenas
FECHA CREACIÓN: 03/03/2021
FECHA ÚLTIMA MODIFICACIÓN: 03/03/2021
OBJETIVO: Se entra un nombre y apellido por separado y muestra las iniciales
-->
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles/generico.css">
<title>Letras en una palabra</title>
</head>
<body>
<script>
/* Declaración de variables */
let nombre, apellido, inicialNombre, inicialApellido;
/* Valores de las variables */
nombre = prompt('Introduce el nombre: ');
apellido = prompt('Introduce el apellido: ');
/* Cálculos */
inicialNombre = nombre.charAt(0).toUpperCase();
inicialApellido = apellido.substring(2,4).toUpperCase();
/* Mostrar resultados */
document.write("<p>Las iniciales de " + nombre + " " + apellido + " son " + inicialNombre + inicialApellido + "</p>");
</script>
<br /><br /><br />
<center>
<a href="Javascript:window.location='view-source:' + window.location">Código fuente</a>
</center>
</body>
</html>