onkeydown事件不触发
<input type=text class="InputNumber" DataType="+" iQty="" minQty="0" onkeydown="NewLine()" onchange="CheckInvQty(this,0)" value="" onfocus="InputData()"/>
我在table中有这样一个input,有onkeydown onchange onfocus三个事件,唯独onkeydown不被触发,我这样写有什么问题么
------解决方案--------------------
http://jsfiddle.net/5XfsB/2/
测试了没问题
------解决方案--------------------
试试 onkeydown="return NewLine(event);"
JScript code
function NewLine(e){
var keynum
var keychar
var numcheck
if(window.event) // IE
{
keynum = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which
}
keychar = String.fromCharCode(keynum)
numcheck = /\d/
return !numcheck.test(keychar)
}