更新时间:2023-12-05 20:39:40
有人给我留下了正确的答案然后因某种原因将其删除了,所以这里是:
Someone left me the correct answer and then removed it for some reason, so here it is:
function IgnoreAlpha(e) {
if (!e) {
e = window.event;
}
if (e.keyCode >= 65 && e.keyCode <= 90) // A to Z
{
e.returnValue = false;
e.cancel = true;
}
}
<p>
<select id="MySelect" name="MySelect" onkeydown="IgnoreAlpha(event);">
<option selected="selected " value=" " />
<option value="A ">A</option>
<option value="B ">B</option>
<option value="C ">C</option>
</select>
</p>