<tr> <td>
<span id="GridView1_ctl03_chinese"> 日本人 </span>
</td> <td>
<span id="GridView1_ctl03_type">名 </span>
</td> <td>
<input name="GridView1$ctl03$japanese" type="text" id="GridView1_ctl03_japanese" onkeydown="textboxfocus('this')" style="width:150px;" />
</td>
</tr> <tr>
<td>
<span id="GridView1_ctl04_chinese"> 韩国人 </span>
</td> <td>
<span id="GridView1_ctl04_type">名 </span>
</td> <td>
<input name="GridView1$ctl04$japanese" type="text" id="GridView1_ctl04_japanese" onkeydown="textboxfocus('this')" style="width:150px;" />
</td>
</tr>
我想要每个text触发onkeydown事件的时候,自动把焦点移动到下一个text
<span id="GridView1_ctl03_chinese"> 日本人 </span>
</td> <td>
<span id="GridView1_ctl03_type">名 </span>
</td> <td>
<input name="GridView1$ctl03$japanese" type="text" id="GridView1_ctl03_japanese" onkeydown="textboxfocus('this')" style="width:150px;" />
</td>
</tr> <tr>
<td>
<span id="GridView1_ctl04_chinese"> 韩国人 </span>
</td> <td>
<span id="GridView1_ctl04_type">名 </span>
</td> <td>
<input name="GridView1$ctl04$japanese" type="text" id="GridView1_ctl04_japanese" onkeydown="textboxfocus('this')" style="width:150px;" />
</td>
</tr>
我想要每个text触发onkeydown事件的时候,自动把焦点移动到下一个text
{
$(":text",$(obj).parent().parent().next()).focus();
}
另:onkeydown="textboxfocus('this')" => onkeydown="textboxfocus(this)"
{
var texts = $(":text");
$.each(texts,function(idx,text){
if(text == obj){
texts[idx+1].focus();
return false;
}
});
}