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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Date</title>
    
    <!-- Estilos bootstarp-->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    <!-- Estilos para esta pagina-->
    <link rel="stylesheet" type="text/css" href="estilos.css">
    
</head>
<body>
    <div class="text-center">
        
    <h1 id="h1"></h1>
       <h2 id="h2">La fecha y la hora son:</h2>
          <div id="fecha"></div>
          <br><br>
          <div id="contenido"></div>
          <br>
          <!-- Boton ver codigo fuente-->
          <a href="codigo.html" target="_blank">
          <button type="button" class="btn btn-light">Ver codigo fuente de este ejercicio</button>
          </a>
            
            
          
    <script type="text/javascript">
      var fecha = new Date();
      var msj;

      if (fecha.getHours() < 7)  { msj = "Buenas noches";}
      else if (fecha.getHours() < 12) { msj = "Buenos días";}
      else if (fecha.getHours() < 21) { msj = "Buenas tardes";}
      else  { msj = "Buenas noches";}

      document.getElementById("h1").innerHTML    = msj;
      document.getElementById("fecha").innerHTML = fecha;

    /* nombre de la persona que hace la entrega o uno ficticio en el titulo   */
     document.getElementById("h1").innerHTML = "Luis Serrat"+"<br>" +msj;
     /* 
     Contenido de innerHTML del elemento identificado por id="h2"
     guardado en variable contenidoH2H2
     */
       var contenidoH2 = document.getElementById('h2').innerHTML;
       var contenidoH2H2 = document.getElementById.innerHTML = contenidoH2 + "<br>";
    
     /* 
     Contenido de outerHTML del elemento identificado por id="h1"
     guardado en variabla outer
     */
       var outer = document.getElementById.innerHTML = "<xmp>" + document.getElementById("h1").outerHTML + "</xmp>";
     /*
     Contenido de de la propiedad global: location.href
     guardado en variable locationH
     */
       var locationH = window.location.href;
       document.getElementById.innerHTML = locationH + "<br>";
     /*
     Contenido de de la propiedad global: location
     guardado en variable locationL
     */
       var locationL = window.location;
       document.getElementById.innerHTML =  locationL +"<br>";
     /*
      Contenido de de las propiedades globales: screen.width y screen.heigth
      guardadas en variable anchoAlto
     */
       var anchoAlto = "Ancho: " + screen.width + " " +  " Alto: " + screen.height;
       document.getElementById.innerHTML = anchoAlto + "<br>";
     /*
     Se muestran en la pagina web  todas las variables, 
     en el orden solicitado
     */
       document.getElementById("contenido").innerHTML = 
       contenidoH2H2+"<br>"
       +outer+"<br>"
       +locationL+"<br>" +"<br>" 
       +location+"<br>"+"<br>" 
       +anchoAlto+ "<br>";

    </script>

    </div>
</body>
</html>