Forum Moderators: open

Message Too Old, No Replies

TAB navigation in IE6

It seems arbitrary where focus goes when user hits TAB in IE6

         

Stines

10:37 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



Hi :) I am having a problem with TAB navigation in IE6! I have made a simple example demonstrating my problem:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TAB test</title>
</head>
<body onload="document.my_form.first.select();">
<form name="my_form" method="post" action="">
<table>
<tr>
<td align="right">First field:</td>
<td><input type="text" name="first"/></td>
</tr>
<tr>
<td align="right">Second field:</td>
<td><input type="text" name="second"/></td>
</tr>
</table>
</form>
</body>
</html>

When you hit TAB from inside the first input field you will sometimes go to the second input field and sometimes you will end up in the address field of the browser! What is going on? :( And how can I fix it? Heeelp!

Thanks a lot in advance,
Stine :)

penders

11:05 pm on Oct 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you are wanting to set 'focus' to the first field, I think you are best using the .focus() method instead of .select() - and this actually seems to solve your problem in IE6!

<body onload="document.my_form.first.focus();">

Using the select() method seems to work OK (in terms of tabing to the next input element in IE), *only* if there is something in the first element to begin with and therefore something to select! (Another anomaly of IE I recon!)

Stines

11:14 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



YES! You are so right:D Thanks a lot!