在Firefox中,如果我在MVC视图中的控件上选中,则Tab键不起作用。它没有进入下一个控制。
function onlyAlphabets(e, t) {
try {
if (window.event) {
var charCode = window.event.keyCode;
}
else if (e) {
var charCode = e.which;
}
else { return true; }
if (charCode == 9 || (charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123))
return true;
else
return false;
}
catch (err) {
alert(err.Description);
}
}
@Html.TextBoxFor(model => model.FirstName, new { @class = "form-control", @placeholder = "First Name", @id = "txtFirstName", @maxlength = "50", onkeypress = "return onlyAlphabets(event,this);" })
@Html.TextBoxFor(model => model.LastName, new { @class = "form-control", @placeholder = "Last Name", @id = "txtLastName", @maxlength = "50", onkeypress = "return onlyAlphabets(event,this);" })
答案 0 :(得分:0)
function onlyAlphabets(e, t) {
try {
if (window.event) {
var charCode = window.event.keyCode;
}
else if (e) {
var charCode = e.which;
}
else { return true; }
if (charCode == 9 || (charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123))
return true;
else
return false;
}
catch (err) {
alert(err.Description);
}
}
@Html.EditorFor(model => model.FirstName, new { @class = "form-control", @placeholder = "First Name", @id = "txtFirstName", @maxlength = "50", onkeypress = "return onlyAlphabets(event,this);" })
@Html.EditorFor(model => model.LastName, new { @class = "form-control", @placeholder = "Last Name", @id = "txtLastName", @maxlength = "50", onkeypress = "return onlyAlphabets(event,this);" })