HTML的tabindex属性可以设定table键所走的位置,看例子中的table键就是按照事先设定好的顺序走的,tabindex的值不一定要连续,只要是正整数数就行:
一个例子:
使用tabindex属性,当txt3为焦点时触发onfocus事件:
<br>//tabindex不可为负值,也不可为小数值
<input type=text value=-10 tabindex="-10"><input type=text value=1 tabindex=1>
<input type=text value=4 tabindex=4>
<input type=text value=5 tabindex=5><input name=txt3 type=text value=3 tabindex=3 onfocus=alert()>
<input type=text value=2 tabindex=2>
一个例子:
使用tabindex属性,当txt3为焦点时触发onfocus事件:
<br>//tabindex不可为负值,也不可为小数值
<input type=text value=-10 tabindex="-10"><input type=text value=1 tabindex=1>
<input type=text value=4 tabindex=4>
<input type=text value=5 tabindex=5><input name=txt3 type=text value=3 tabindex=3 onfocus=alert()>
<input type=text value=2 tabindex=2>
function document.onkeydown()
{
if (event.keyCode == 9)
alert(event.srcElement.tagName);
}
</script>
制表符 I think
<input onkeydown="if(event.keyCode==13)event.keyCode=9">
你用 onblur 事件嘛<input type=text onblur="alert('此控件失去了焦点!')">