Simple scenario:
You have 3 textboxes on the screen (txt1, txt2, txt3). When the focus leaves (onBlur) txt1 I want to manually set the focus to txt2 only if the reason focus was lost on txt1 was due to the tab button.
onBlur event has a keyCode (event.keyCode) of zero (0) (tab key keyCode is 9).
=========
Below does not work because txt2 gets focus before the tab key is finsihed being pressed. The implicit event handler sees the focus of the cursor as txt2 then tabs to txt3.
<script>
function doTab(evt)
{
if (evt.keyCode == 9)
{
document.all.txt2.focus();
}
}
</script>
<input type="text" id="txt1" onkeyup="doTab(event);">
<input type="text" id="txt2">
<input type="text" id="txt3">
========
This is an over-simplified example. I realize that in this scenario I could let tabbing work as usual but my "real-world" need for this behavior is much more complex.
Thank you for any help.
You have 3 textboxes on the screen (txt1, txt2, txt3). When the focus leaves (onBlur) txt1 I want to manually set the focus to txt2 only if the reason focus was lost on txt1 was due to the tab button.
onBlur event has a keyCode (event.keyCode) of zero (0) (tab key keyCode is 9).
=========
Below does not work because txt2 gets focus before the tab key is finsihed being pressed. The implicit event handler sees the focus of the cursor as txt2 then tabs to txt3.
<script>
function doTab(evt)
{
if (evt.keyCode == 9)
{
document.all.txt2.focus();
}
}
</script>
<input type="text" id="txt1" onkeyup="doTab(event);">
<input type="text" id="txt2">
<input type="text" id="txt3">
========
This is an over-simplified example. I realize that in this scenario I could let tabbing work as usual but my "real-world" need for this behavior is much more complex.
Thank you for any help.