Dynamic taboo index

I have many rows, each row has a column with only <input type='text'/> , for example:

HTML:

 <table> <tr> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> </tr> <tr> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> </tr> </table> 

php:

 while(!$res->EOF) { // then come another while() from other db consult while(!$res2->EOF) { // this create the dynamic columms. } } 

I am creating these rows from the result of db, and the number of columns is dynamic, sometimes more and sometimes less.

I need tabindex to follow the current vertical mode column.

I did exp: Jsfiddle

Any question please.

Thanks.

+4
source share
1 answer

You need to know how many lines you have. Tab indices will look like this:

 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15 

Here is the formula for getting the index of each cell:

 tabindex=rowNum+(rowCount*colnumber) 

I will leave the implementation as an exercise for the reader.

+2
source

All Articles