L
leodippolito
Hello,
I have an input element with an onfocus event handler that is
responsible for changing its value:
---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script>
function doSomething(objSender)
{
objSender.value = 'abc';
}
</script>
</head>
<body>
<INPUT id="input1" type="text"><br>
<INPUT id="input2" type="text"
onfocus="doSomething(this);"><br>
<INPUT id="input3" type="text">
</body>
</html>
---
The problem is:
I am in input1 and press the TAB key to navigate to input2. At this
moment, if input2 is empty, it will change for 'abc' and will receive
the focus (the cursor will be there). So far so good.
However, if input2 is not empty, after pressing the TAB key, input2
will change for 'abc' and WILL NOT RECEIVE THE FOCUS!
Why this behavior? How can I have the focus set in input2, no matter if
it's empty or not?
I appreciate any help.
Leonardo D'Ippolito
I have an input element with an onfocus event handler that is
responsible for changing its value:
---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script>
function doSomething(objSender)
{
objSender.value = 'abc';
}
</script>
</head>
<body>
<INPUT id="input1" type="text"><br>
<INPUT id="input2" type="text"
onfocus="doSomething(this);"><br>
<INPUT id="input3" type="text">
</body>
</html>
---
The problem is:
I am in input1 and press the TAB key to navigate to input2. At this
moment, if input2 is empty, it will change for 'abc' and will receive
the focus (the cursor will be there). So far so good.
However, if input2 is not empty, after pressing the TAB key, input2
will change for 'abc' and WILL NOT RECEIVE THE FOCUS!
Why this behavior? How can I have the focus set in input2, no matter if
it's empty or not?
I appreciate any help.
Leonardo D'Ippolito