Você está na página 1de 1

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Compra de mascotas</title>
</head>
<body>
<h1>Bienvenido a la tienda de mascotas</h1>
<h2>Aquí encontrarás los mejores productos para tus mascotas</h2>
<img src="mascotas.jpg" alt="Imagen de mascotas" width="400px">

<h3>Compra aquí</h3>
<form id="formulario">
<label for="nombre">Nombre:</label>
<input type="text" id="nombre" name="nombre" required><br><br>

<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>

<label for="mascota">Mascota:</label>
<select id="mascota" name="mascota" required>
<option value="gato">Gato</option>
<option value="perro">Perro</option>
<option value="hamster">Hamster</option>
<option value="conejo">Conejo</option>
</select><br><br>

<label for="producto">Producto:</label>
<select id="producto" name="producto" required>
<option value="alimento">Alimento</option>
<option value="juguetes">Juguetes</option>
<option value="collar">Collar</option>
<option value="correa">Correa</option>
</select><br><br>

<input type="submit" value="Comprar">


</form>

<script>
document.getElementById("formulario").addEventListener("submit",
function(event){
event.preventDefault();

let nombre = document.getElementById("nombre").value;


let email = document.getElementById("email").value;
let mascota = document.getElementById("mascota").value;
let producto = document.getElementById("producto").value;

alert(`Nombre: ${nombre}\nEmail: ${email}\nMascota: ${mascota}\


nProducto: ${producto}`);
});
</script>
</body>
</html>

Você também pode gostar