<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
function bgChange(bg) {
document.body.style.background = bg;
}
</script>
</head>
<body>
<h3>Monumentos existentes en la Ciudad de Santander</h3>
<p>Localiza los monumentos, por nombre, a través del buscador</p>
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Buscar por nombre">
<table id="myTable">
<tr class="header">
<th style="width:30%;">Nombre</th>
<th style="width:40%;">Descripción</th>
<th style="width:30%;">Lugar</th>
</tr>
<tr>
<td>Mapa en relieve de Cantabria</td>
<td>Autor: José Tornás Jiménez.1954</td>
<td>Plaza de las Brisas</td>
</tr>
<tr>
<td>Mesa Zodiacal</td>
<td>Monumento significativo de los Jardines de Piquio</td>
<td>Jardines de Piquio</td>
</tr>
<tr>
<td>Tierra Paralela</td>
<td>Instrumento para medir el tiempo</td>
<td>Jardines de Piquio</td>
</tr>
<tr>
<td>Hombres del Mar</td>
<td>Autor: José Carrilero. 1968</td>
<td>Residencia Piquio-El Sardinero</td>
</tr>
<tr>
<td>San Roque</td>
<td>Autor: Cristino Mallo. 1970</td>
<td>C/ Cruces</td>
</tr>
<tr>
<td>Augusto Gonzalez Linares</td>
<td>Autor: José Quintana. 1908</td>
<td>Avda. Reina Victoria</td>
</tr>
<tr>
<td>Recuerdo de San Roque</td>
<td>Antigua ubicación de la Ermita de San Roque</td>
<td>Avda. Reina Victoria</td>
</tr>
<tr>
<td>Marquesa de Pelayo</td>
<td>Sobrina del Marqués de Valdecilla</td>
<td>Avda. Reina Victoria</td>
</tr>
<tr>
<td>Enrique Gran</td>
<td>Autora: Gema Soldevilla. 2009</td>
<td>Avda. Reina Victoria (frente entrada C/ Ramón y Cajal)</td>
</tr>
...
CSS
h3 {
color: #808080;
font-family: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif;
font-size: 200%;
}
#myInput {
background-image: url('https://www.w3schools.com/css/searchicon.png'); /* Añadimos un icono de búsqueda al input*/
background-position: 10px 12px; /* Ubicamos la posición del icono */
background-repeat: no-repeat; /* Indicamos que no se repita la imageb */
width: 100%; /* Le damos ancho completo */
font-size: 16px; /* Le damos tamaño */
padding: 12px 20px 12px 40px; /* Le damos el padding */
border: 1px solid #ddd; /* Añadimos un borde gris */
margin-bottom: 12px; /* Añadimos espacio en el borde superior */
}
#myTable {
border-collapse: collapse; /* Fusionamos los bordes de la tabla */
width: 100%;
border: 1px solid #ddd;
font-size: 18px;
}
#myTable th, #myTable td {
text-align: left;
padding: 12px;
}
#myTable tr {
/* Añadimos un borde superior a la tabla */
border-bottom: 1px solid #ddd;
}
#myTable tr.header, #myTable tr:hover {
/* Añadimos un fondo gris claro al encabezado de tabla */
background-color: #f1f1f1;
}
JavaScript
function myFunction() {
// Declaramos las variables
var input, filter, table, tr, td, i;
// Las inicializamos
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
/* Hacemos un bucle a través de todas las filas de la tabla y ocultamos
las que no coinciden con la consulta de búsqueda */
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.