Display tab index highlight

I want to display a Hightlight on element containing tabindex.

<FORM ACTION="../cgi-bin/mycgi.pl" METHOD=POST>
            <TABLE BORDER CELLPADDING=3 CELLSPACING=5 BGCOLOR="#FFFFCC">
            <TR>
                 <TD>name: <INPUT NAME="realname" TABINDEX=4 ACCESSKEY="g" VALUE="Go!"></TD>

             <TD ROWSPAN=3>comments<BR>
             <TEXTAREA COLS=25 ROWS=5 TABINDEX=3></TEXTAREA></TD></TR>
        <TR> <TD>email: <INPUT NAME="email" TABINDEX=2></TD></TR>
        <TR> <TD>department: <SELECT NAME="dep" TABINDEX=1>
             <OPTION VALUE="">...
             <OPTION VALUE="mkt">Marketing
             <OPTION VALUE="fin">Finance
             <OPTION VALUE="dev">Development
             <OPTION VALUE="prd">Production</SELECT></TD></TR>
        <tr>
            <td><input type="button" tabindex="7" value="Tab7"></td>
            <td><a href="http://www.google.com" tabindex=6>This is tab6</a></td>
        </tr>
        <tr>
            <td><p tabindex=8>this is tab 8</p></td>
            <td><span tabindex=9 onkeypress="return runScript(event)">this is tab 9</span></td>
        </tr>
        <tr>
            <td><input tabindex=10 id="scriptBox" type="text" /></td>
        </tr>
        </TABLE>
     </FORM>

When I press the key Tab4 times, it goes to the element containing "tabindex=4"and displays the selection on it.

I am glad to receive an idea from you.

Greetings

Chanthou

+3
source share
2 answers

You can select all elements with the attribute tabindex:

<style>
*[tabindex] {
 border: solid red 1px;
}
</style>

<p><input type="text" tabindex="1" /></p>

<p tabindex="2">Hello</p>

The question is a bit ambiguous - do you want to highlight an element when it has focus or to highlight an element that can have focus?

+3
source

If you know css, you can use the: focus class pseudo-class to highlight an element when it has keyboard focus.

, :
input:focus { background: #ccc; }

+1

Source: https://habr.com/ru/post/1729033/


All Articles