olimpa commited on
Commit
c26a58b
1 Parent(s): 731aa54

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +41 -7
script.js CHANGED
@@ -4,11 +4,13 @@ function mostrarBienvenida() {
4
  alert("¡Hola " + nombre + "! Bienvenido a nuestra iglesia.");
5
  }
6
 
7
- // Función para mostrar un mensaje de despedida al usuario
8
  function mostrarDespedida() {
 
9
  alert("¡Hasta pronto " + nombre + "! Te esperamos la próxima vez.");
10
  }
11
 
 
12
  // Llamamos a la función mostrarBienvenida al cargar la página
13
  mostrarBienvenida();
14
 
@@ -33,11 +35,43 @@ function exportarPDF() {
33
  window.print();
34
  }
35
 
36
- document.getElementById("imgData").addEventListener("click", exportarImagen);
37
  document.getElementById("exportarPDF").addEventListener("click", exportarPDF);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
- // Función para ocultar los botones
40
- function ocultarBotones() {
41
- var botonesExportacion = document.querySelector('.botones-exportacion');
42
- botonesExportacion.classList.add('oculto');
43
- }
 
4
  alert("¡Hola " + nombre + "! Bienvenido a nuestra iglesia.");
5
  }
6
 
7
+
8
  function mostrarDespedida() {
9
+ const nombre = prompt("Ingrese su nombre");
10
  alert("¡Hasta pronto " + nombre + "! Te esperamos la próxima vez.");
11
  }
12
 
13
+
14
  // Llamamos a la función mostrarBienvenida al cargar la página
15
  mostrarBienvenida();
16
 
 
35
  window.print();
36
  }
37
 
 
38
  document.getElementById("exportarPDF").addEventListener("click", exportarPDF);
39
+ // Función para ocultar los botones
40
+ function ocultarBotones() {
41
+ var botonesExportacion = document.querySelector('.botones-exportacion');
42
+ botonesExportacion.classList.add('oculto');
43
+ }
44
+
45
+ // Función para mostrar las opciones desplegables
46
+ function mostrarOpcionesDesplegables() {
47
+ var botonDesplegable = document.getElementById('botonDesplegable');
48
+ var opciones = document.createElement('div');
49
+ opciones.innerHTML = `
50
+ <button id="imgData">Exportar a imagen</button>
51
+ <button id="exportarPDF">Exportar a PDF</button>
52
+ <button id="despedida">Despedida</button>
53
+ `;
54
+
55
+ // Asignar eventos a los nuevos botones
56
+ document.getElementById("imgData").addEventListener("click", function() {
57
+ exportarImagen();
58
+ ocultarBotones();
59
+ });
60
+ document.getElementById("exportarPDF").addEventListener("click", function() {
61
+ exportarPDF();
62
+ ocultarBotones();
63
+ });
64
+ document.getElementById("despedida").addEventListener("click", function() {
65
+ mostrarDespedida();
66
+ ocultarBotones();
67
+ });
68
+
69
+ // Ocultar botón desplegable
70
+ botonDesplegable.style.display = 'none';
71
+
72
+ // Insertar las opciones después de ocultar el botón desplegable
73
+ botonDesplegable.parentNode.insertBefore(opciones, botonDesplegable.nextSibling);
74
+ }
75
 
76
+ // Llamamos a la función mostrarOpcionesDesplegables al hacer clic en el botón "Opciones"
77
+ document.getElementById("botonDesplegable").addEventListener("click", mostrarOpcionesDesplegables);