Bài học
Lưu code
Refresh
Xoay
Xem kết quả
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Ví dụ HTML</title> </head> <body > <div style="margin:30px"> <script> function validate(){ var num=document.myform.num.value; if (isNaN(num)){ document.getElementById("numloc").innerHTML="Enter Numeric value only"; return false; }else{ return true; } } </script> <form name="myform" onsubmit="return validate()" > Number: <input type="text" name="num"><span id="numloc"></span><br/> <input type="submit" value="submit"> </form> </div> </body> </html>