All the lines of code in the following function enteringRentAmt(sender,args), are working except "ctlNumYears.focus();" If there's an entry in txtRentAmt, the txtRentNumberYearAmt box should be enabled and get focus. Instead, it is enabled but the focus goes to the next textbox after it (txtLoans). Works in IE8 and FF, not in Chrome or Safari.
Suggestions appreciated.
<script type="text/javascript">
function enteringRentAmt(sender, args)
{
var ctlNumYears;
var ctlRentAmt;
var ctlLoans;
args.IsValid = true;
ctlNumYears = document.getElementById("<%=txtRentNumberYearAmt.ClientID%");
ctlRentAmt = document.getElementById("<%=txtRentAmt.ClientID%>");
ctlLoans = document.getElementById("<%=txtLoansAmt.ClientID%>");
if (args.Value.length > 0)
{
//enable No. of Years
ctlNumYears.disabled = false;
ctlNumYears.focus();
}
else
{
ctlNumYears.value = "";
ctlRentAmt.focus();
ctlNumYears.disabled = true;
ctlLoans.focus();
}
} // end of enteringRentAmt
</script>


LinkBack URL
About LinkBacks



Reply With Quote