This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15456|Reply: 1

[Jquery] jquery verifies that the user entered the age correctly

[Copy link]
Posted on 5/27/2015 3:51:30 PM | | | |

I just learned jquery, and what I wrote may not be correct, but it can be verified normally, and I will share it for your reference.

  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head><title>

  3. </title>
  4.     <scrip去掉t src="scrip去掉ts/jquery-1.4.1.js" type="text/javascrip去掉t"></scrip去掉t>
  5.     <scrip去掉t type="text/javascrip去掉t">
  6.         $().ready(
  7.             function () {
  8.                 $("#txtage").blur(
  9.                     function () {
  10.                         if (isNaN($("#txtage").val())) {
  11.                             $("#labage").text("请输入整数!");
  12.                         } else {
  13.                             if ($("#txtage").val() > 99 || $("#txtage").val() < 0) {
  14.                                 $("#labage").text("请输入0-99之间!");
  15.                             } else {
  16.                                 $("#labage").text("");
  17.                             }

  18.                         }
  19.                     }
  20.                 );
  21.             }

  22.         );
  23.     </scrip去掉t>
  24. </head>
  25. <body>
  26.     <form method="post" action="WebForm1.aspx" id="form1">
  27. <div class="aspNetHidden">
  28. <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZJWeBwsoKPQopHcY1RhEXRn5LJTG45ip0VWYP9uWZTuh" />
  29. </div>

  30. <div class="aspNetHidden">

  31.         <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C687F31A" />
  32. </div>
  33.     <div>
  34.         请输入年龄:<input id="txtage" type="text" /><label id="labage"></label>
  35.     </div>
  36.     </form>
  37. </body>
  38. </html>
Copy code






Previous:[Vigilant] Mobile phone viruses are too scoundrels: don't give money and don't let the screen be unlocked
Next:C# DataTable to manually add data records
Posted on 5/27/2015 11:32:08 PM |
Copy my code
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com