For years, teaching
CodePudding user response:
For example& lt; html>
<meta HTTP - equiv="content-type" content="text/HTML. Charset=utf-8 "& gt;Sample
<script type="text/javascript"> Window. The onl oad=function () {
Document. The getElementById (" tField "). Onfocusout=function () {
if (! The (/^ \ d + $/document. GetElementById (" tField "). The value)) {
Alert (" can only input Numbers ");
//if you don't let go of focus, and is the document. The getElementById (" tField "). The focus ();
}
}
}
//- & gt; </script>
<body>