-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheven_and_odd.html
More file actions
52 lines (51 loc) · 1.56 KB
/
even_and_odd.html
File metadata and controls
52 lines (51 loc) · 1.56 KB
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
<!DOCTYPE html>
<html lang="es-es">
<head>
<title>JavaScript 1</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header id="flex-container-1">
<div>
<figure>
<a href="index.html"><img src="logotipo.png" alt="Logotipo-de-donut-Web-JavaScript-Facilito" /></a>
</figure>
</div>
<div>
<h1>Introducción a JavaScript</h1>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
</ul>
</nav>
</div>
</header>
<article>
<h1>
Introducción a JavaScript - Ejercicio 1 - Even and odd / Par o impar
</h1>
<h3 id="demo">
Haz click en el botón para ejecutar el programa. Puedes indicar un numero y te dirá si es par o impar.
</h3>
<button type="button" onclick="myFunction()">Click aqui</button>
</article>
<article>
<figure>
<img src="javaScript_1_par_impar.jpg"/>
</figure>
</article>
<script type="text/JavaScript">
var numero1;
function myFunction(numero1){
numero1 = window.prompt ("Introduce un numero" , "");
numero1 = parseInt (numero1);
if(numero1 % 2 == 0){
document.getElementById("demo").innerHTML = "Tu numero es par!";
}
else{
document.getElementById("demo").innerHTML = "Tu numero es impar!";
}
}
</script>
</body>
</html>