我有一個表單,我在其中使用4個文本框。標籤按鈕不在表單文本字段中工作
textfield1的 文字欄 文字欄 文字欄
我呼籲文字欄和文字欄上的「onpress」事件功能只檢查整數值。該功能在下面給出。
function checkIntnumber(obj,event){
var unicode=event.charCode? event.charCode : event.keyCode
if((unicode==37 || unicode==39 || unicode==35 || unicode==36 || unicode==46)
&& event.which==0) {//if the key isn't the (BackSpace/Left Arrow/Right
Arrow/Delete/Home/End) key (which we should allow)
return true;
} else if(unicode!=8) {
if (unicode>=48 && unicode<=57) { //if a number
return true; //enable key press
} else {
return false; //disable key press
}
}
}
現在的話,我從textfield1的移動使用TAB鍵,這是工作正常,但tab鍵不能正常工作,從文本字段2到文字欄或文字欄移動到文字欄以文字欄。這個問題只發生在Mozilla Firefox中。請幫幫我。 感謝
編輯:從答案下方留言代碼 -
<input type="text" name="from" id="from" style="width:50px;"
onkeypress="hideRateDiv();return checkIntnumber(this,event)"/>
- <input type="text" name="to" id="to" style="width:50px;"
onkeypress="hideRateDiv();return checkIntnumber(this,event)" tabindex="2"/>
聽起來更像是tabindex屬性,而不是事件綁定一個問題... –
那麼我應該怎麼做呢? – manishjangir
http://www.w3.org/TR/html4/interact/forms.html#adef-tabindex檢查此鏈接 –