用Jquery控制文本框只能输入数字和字母
$.fn.onlyNum = function () { $(this).keypress(function (event) { var eventObj = event || e; var keyCode = eventObj.keyCode || eventObj.which; if ((keyCode >= 48 && keyCode <= 57) || ((keyCode == 8 || keyCode == 46))) return true; else return false; }).focus(function () { //禁用输入法 this.style.imeMode = 'disabled'; }); };