Dynamic tabindex
I have a lot of rows, each row has a column with only <input type='text'/>
, like this:
html:
<table>
<tr>
<td><input type="text" size="10"/></td>
<td><input type="text" size="10"/></td>
<td><input type开发者_JAVA技巧="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'm creating this rows from a db result, and the numbers of columns is dynamic, sometimes more and sometimes less.
I need the tabindex follow the current column "vertical mode".
I made a exp: Jsfiddle
Any question, please.
Thanks.
You need to know how many rows you have. Your 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 to the reader.
精彩评论