window.onload = function () { document.getElementById('text1').onblur = function () { if (isNaN(document.getElementById('text1').value)) { 验证输入的字符是否为数字 alert(请检查输入的值是否正确); document.getElementById('text1').value = ; } } }
转载于:https://www.cnblogs.com/handsomer/p/3678222.html