<html>
<script language="VBScript">
Sub filterResults()
Dim searchBox
Set searchBox = Document.forms("searchBoxID")
For Each subInstance In document.GetElementsByTagName("tr")
If Not subInstance.OuterHTML.Contains(searchBox.filterTXT.Value) Then
subInstance.style = "display:none"
End If
Next
End Sub
</script>
<form id="searchBoxID"
onsubmit="filterResults(); return false;" language="jscript">
Filter results: <input name="filterTXT" type="text" size="2"/><input name="searchBTN" type="Submit" value="Go">
<table border=1>
<th>
Row One
</th>
<th>
Row Two
</th>
<th>
Row Three
</th>
<tr>
<td>
Stuff
</td>
<td>
Things
</td>
<td>
Items
</td>
</tr>
<tr>
<td>
Possessions
</td>
<td>
Objects
</td>
<td>
Things
</td>
</tr>
</table>
</html>
I am trying to filter this table by using a search box. If the keyword doesn't match anything in a row, that row is hidden. Problem is nothing gets hidden.
-
Edited by
tyler_montney
1 hour 1 minutes ago