日期:2014-05-16 浏览次数:20340 次
//检查数字 function funCheckInt() { alert(event.keyCode); if (event.keyCode>= 48 && event.keyCode <= 57 ||event.keyCode==8 ||event.keyCode>=96&&event.keyCode<=105) { } else if(event.keyCode==13) { PageSkip();//跳页 event.returnValue=false; } else { event.returnValue=false; }; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <input name="84" type="text" id="84" class="btnshop" onkeydown='funCheckInt(event)' /> <script> function funCheckInt(event) { event = event || window.event; alert(event.keyCode); if (event.keyCode >= 48 && event.keyCode <= 57 || event.keyCode == 8 || event.keyCode >= 96 && event.keyCode <= 105) { } else if (event.keyCode == 13) { PageSkip(); //跳页 event.returnValue = false; } else { event.returnValue = false; }; } </script> </body> </html>