inpupt控件 <%--验证整数,实现.Net验证控件的效果--%> <div> <input type ="text" id="yy1" onkeyup ="yz()" /> <span id="sp" style ="color :Red" ></span> </div> js代码 function yz() { var q8 = document.getElementById("yy1"); var q9 = document.getElementById("sp"); var t = parseInt(q8.value); if (isNaN(t) == true) { q9.innerHTML="不是整数"; } else { q9.innerHTML = "是整数"; }