以下のWebサイトからJavascript検索を使用しようとしていますが、単語の一部を入力するとテーブル行も返されるように、検索された正確な用語のみを返す方法があるかどうか疑問に思っていました.
すなわち。「ヒース」を検索すると、ヒースを検索した場合と同じ結果が返されます」、簡単な回避策はありますか?
スクリプト: http://heathesh.com/post/2010/05/06/Filtering-or-searching-an-HTML-table-using-JavaScript.aspx
例: http://heathesh.com/code/javascript/tablesearch/
<table border="1" cellpadding="0" cellspacing="0">
    <tr>
        <th>ID</th>
        <th>First Name</th>
        <th>Surname</th>
        <th>Website</th>
    </tr>
    <tbody id="data">
        <tr>
            <td>1</td>
            <td>Heathesh</td>
            <td>Bhandari</td>
            <td><a href="http://heathesh.com">http://heathesh.com</a></td>
        </tr>
        <tr>
            <td>2</td>
            <td>Candice</td>
            <td>David</td>
            <td><a href="http://candicedavid.com">http://candicedavid.com</a></td>
        </tr>
    </tbody>
</table>
//define the table search object, which can implement both functions and properties
    window.tableSearch = {};
    //initialize the search, setup the current object
    tableSearch.init = function() {
        //define the properties I want on the tableSearch object
        this.Rows = document.getElementById('data').getElementsByTagName('TR');
        this.RowsLength = tableSearch.Rows.length;
        this.RowsText = [];
        //loop through the table and add the data to the table search object
        for (var i = 0; i < tableSearch.RowsLength; i++) {
            this.RowsText[i] = (tableSearch.Rows[i].innerText) ? tableSearch.Rows[i].innerText.toUpperCase() : tableSearch.Rows[i].textContent.toUpperCase();
        }
    }
次に、実際の JavaScript 関数を作成して、次のように検索を実行します。
    //onlys shows the relevant rows as determined by the search string
    tableSearch.runSearch = function() {
        //get the search term
        this.Term = document.getElementById('textBoxSearch').value.toUpperCase();
        //loop through the rows and hide rows that do not match the search query
        for (var i = 0, row; row = this.Rows[i], rowText = this.RowsText[i]; i++) {
            row.style.display = ((rowText.indexOf(this.Term) != -1) || this.Term === '') ? '' : 'none';
        }
    }
    //handles the enter key being pressed
    tableSearch.search = function(e) {
        //checks if the user pressed the enter key, and if they did then run the search
        var keycode;
        if (window.event) { keycode = window.event.keyCode; }
        else if (e) { keycode = e.which; }
        else { return false; }
        if (keycode == 13) {
            tableSearch.runSearch();
        }
        else { return false; }
    }
<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td>
                <input type="text" size="30" maxlength="1000" value="" id="textBoxSearch" onkeyup="tableSearch.search(event);" />
                <input type="button" value="Search" onclick="tableSearch.runSearch();" />
            </td>
        </tr>
    </tbody>
</table>