teslariu

func3

Jul 18th, 2022
1,343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
  7.     <title>Probando JavaScript</title>
  8.     <style>
  9.         table,th,td,tr {
  10.             border: 1px solid black;
  11.             border-collapse: collapse;
  12.         }
  13.     </style>
  14. </head>
  15. <body>
  16.     <button onclick="saludar('Ana')">Ana</button>
  17.     <button onclick="saludar('Pepe')">Pepe</button>
  18.     <button onclick="saludar('Tito')">Tito</button>
  19.     <button onclick="saludar('Juan')">Juan</button>
  20.     <p id="saludo"></p>
  21.    
  22.     <script>
  23.         // Modificar el script para cambiar el color del botón presionado
  24.         function saludar(nombre) {
  25.             document.getElementById("saludo").innerHTML = "Hola " + nombre;
  26.     }
  27.    
  28.    
  29.     </script>
  30.    
  31. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment