how to focus a table cell using javascript?

javascript, jquery

Solution

OK:

var oHighlightedRow = document.all("SearchRow" + nHighlightedRow);
oHighlightedRow.cells[0].focus();

Or, better (assuming the row has an id of `"SearchRow" + nHighlightedRow`):

var oHighlightedRow = document.getElementById("SearchRow" + nHighlightedRow);
oHighlightedRow.cells[0].focus();

Or, jQuery (again assuming the row has an id of `"SearchRow" + nHighlightedRow`):

$("#SearchRow" + nHighlightedRow + " td:first").focus();

Problem

VB script statement , `Set oHighlightedRow = document.all("SearchRow" & nHighlightedRow)` `oHighlightedRow.cells(0).focus()` These two statments need to be converted to javascript.anyone can help me to find a solution? Thanx My converted code was, ``` var oHighlightedRow = $("#SearchRow" + nHighlightedRow); oHighlightedRow.cells[0].focus(); ``` Is this correct ?

Original source