Hi I am trying to set the focus to a textbox when validation errors out. below is the code I am trying to use and I keep getting an error that says tBox is undefined. Also, are there any focus methods or workarounds to get this working in both IE and firefox, rather than just IE? Thanks.
Javascript:
HTML:
Javascript:
Code:
function cell_onblur(sender)
{
sender.value = trim(sender.value);
if(isNumeric(sender.value))
sender.style.backgroundColor = '';
else
{
var tBox = sender;
setTimeout("tBox.focus()", 100);
alert('Not a valid number. \nPlease reenter number of units.');
}
}
HTML:
Code:
<td>
<input onkeydown="return cell_onKeyDown(event)" onchange="cell_onchange(this)" onfocus="cell_onfocus(this)" [red]onblur="cell_onblur(this)"[/red] type="text" value="14" />
</td>