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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
function findNextSection2 ( ){
var index = TRIndex;
var tableObj = parent.frames["content"].document.getElementById("main_table");
if ( tableObj == null )
return null;
// --- Search for TBODY element of the table
for ( var i = 0; i < tableObj.childNodes.length; i++ )
if ( tableObj.childNodes[i].nodeName == "TBODY" ){
tableObj = tableObj.childNodes[i];
break;
}
if ( tableObj.childNodes.length < (index) )
return null;
// --- Init start index in the next TR / line
var i = 0;
var elementFound = false;
var elemt = null;
var labelToFind = "section_"+INDEX_FIELD_FOCUSED;
// --- Find the real index of table content (because of comment childs)
var i = 0;
while ( !elementFound && i < tableObj.childNodes.length ){
if (tableObj.childNodes[i].nodeName == "TR"){
if ( tableObj.childNodes[i].name != null && tableObj.childNodes[i].name.indexOf(labelToFind) != -1 ){
isFocusedObjFound = true;
elemt = findNext(tableObj.childNodes[i],false);
if ( elemt != null )
elementFound = true;
}
}
// --- Increase counter
i++;
}
// --- Set focus on the retrieved element if not null
if ( elemt != null ){
if ( elemt.nodeName.toLowerCase() == "select" ){
self.document.activeElement.blur();
}
elemt.focus();
}
}
function findNext ( elem, isTestIt ){
// --- Test if current element if focusable
if ( isTestIt ){
// --- Check if current elem is focusable
if ( isFocusedObjFound == true && isFocusableElem(elem) )
return elem;
// --- Check if current element is the focused element
if ( !isFocusedObjFound && elem == focusedObj )
isFocusedObjFound = true;
}
// --- Roll on focused element child nodes to find one focusable
var found = false;
var retrievedElem = null;
if ( elem.childNodes ){
for (var i = 0; i < elem.childNodes.length; i++){
retrievedElem = findNext(elem.childNodes[i],true);
if ( retrievedElem != null )
break;
}
}
// --- Finally return the element retrieved or null if not found
return retrievedElem;
} |