Reply to Re: Why is the cursor not going to the next checkbox if I press Tab

Your name:

Reply:


Posted by Benjamin Niemann on 03/01/06 13:13

Stefan Mueller wrote:

> If I click on the first image (mypic1.gif) and then press once theTab key
> the focus is not going to the next checkbox within Internet Explorer. With
> Mozilla Firefox it's working already the first time.
>
> <html>
> <body>
> <img src= 'mypic1.gif' tabindex = '0'>
> <input type = 'checkbox'>
> <p>
> <img src= 'mypic2.gif' tabindex = '0'>
> <input type = 'checkbox'>
> </body>
> </html>
>
> Is there any possibility to tell Internet Exporer also to jump to the next
> checkbox if the Tab key is pressed only once?

IMG element don't have a TABINDEX attribute and there's no defined meaning
for 'give focus to an IMG element'. Firefox give focus to the first INPUT
element on the first press of tab - it should be irrelevant that you
clicked on the image, though it might be necessary to click somewhere in
the document.

What do you really want?

Should the checkbox be toggled by clicking on the image?
This can be done by wrapping the IMG and the INPUT in a LABEL element:

<label>
<img src= 'mypic1.gif'>
<input type = 'checkbox'>
</label>

Or (in more complex layouts where the IMG and INPUT are not directly
adjacent):

<label for="box1"><img src= 'mypic1.gif'></label>
<input id="box1" type = 'checkbox'>

Should the checkbox just get focus when the image is clicked, but the state
should not change?
Might be done with JavaScript, but such a solution would be as unreliable as
JavaScript.

If you need the TABINDEX attribute (which is only needed, when the tab order
order is different from the source order), put it on the INPUT element. A
TABINDEX of 0 is the default and equal to no explicit TABINDEX attribute at
all.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация