-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
57 lines (52 loc) · 1.53 KB
/
index.html
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
<!DOCTYPE html>
<html>
<body>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<script>
function myFunction() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
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";
}
}
}
}
</script>
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for restaurant name...">
<table id="myTable">
<tr class="header">
<th style="width:60%;">Lunch Spot</th>
<th style="width:40%;">Mike Stars</th>
</tr>
<tr>
<td>Halal Cart</td>
<td><img src="mike.png"><img src="mike.png"><img src="mike.png"><img src="mike.png"><img src="mikehalf.png"></td>
</tr>
<tr>
<td>Ohana Poke</td>
<td><img src="mike.png"><img src="mike.png"><img src="mike.png"><img src="mike.png"><img src="mike.png"></td>
</tr>
<tr>
<td>Rooster and Rice</td>
<td><img src="mike.png"><img src="mike.png"><img src="mike.png"><img src="mike.png"></td>
</tr>
<tr>
<td>McDonald's</td>
<td><img src="mike.png"><img src="mike.png"><img src="mike.png"><img src="mikehalf.png"></td>
</tr>
</table>
</body>
</html>