Okay. Let's try a different angle. Here's my code. In the instance where "question('clear1')" is called, when "tableContainer1" is replaced by "tableContainer0" focus goes to the object "IName", which is a textbox inside "tableContainer0" just as it should. However, in the instance where "question('clear2')" is called, when "tableContainer0" is replace by "tableContainer2" focus does not go to the object "numberLiabilityLosses1", which is a set of radiobuttons need "numberOfLiabilityLosses" and whose first element has the id "numberLiabilityLosses1", until the tab key is pressed.
This is the Javascript...
-
Node.prototype.swapNode = function (node) {
-
var nextSibling = this.nextSibling;
-
var parentNode = this.parentNode;
-
node.parentNode.replaceChild(this, node);
-
parentNode.insertBefore(node, nextSibling);
-
}
-
-
function question(x){
-
if(x=="clear1"){
-
document.getElementById('tableContainer1').swapNode(document.getElementById('tableContainer0'));
-
document.getElementById('tableContainer1').style.visibility="hidden";
-
document.getElementById('tableContainer0').style.visibility="visible";
-
document.getElementById('tableContainer0').style.visibility="visible";
-
document.getElementById('IName').focus();
-
}
-
-
-
if(x==clear2){
-
document.getElementById('tableContainer0').swapNode(document.getElementById('tableContainer5'));
-
document.getElementById('tableContainer0').style.visibility="hidden";
-
document.getElementById('tableContainer5').style.visibility="visible";
-
scroll(0,0);
-
document.getElementById('numberLiabilityLosses1').focus();
-
}
-
}
-
and this is the HTML that calls it.
-
<input type="button" value=" Continue " id="B0" onClick="question('clear2')" name="B0" style="font-family: Tahoma; font-size: 8pt; font-weight: bold">
-
I need for the focus to move to the radiobuttion just as it would to a textbox.
This problem occurs when a set of radiobuttons follows a "swapNode" call.