http://www.iteye.com/news/23823

https://www.cnblogs.com/xumanbu/p/5019474.html

<!doctype html>

<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 <script type="text/javascript">
     var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
     var money = "520.100";
     //000 错
     //0 对
     //0. 错
     //0.0 对
     //050 错
     //00050.12错
     //70.1 对
     //70.11 对
     //70.111错
     //500 正确
     if (reg.test(money)) {
          alert("正确~");
     }else{
          alert("有误~");
     };
 </script>
   
 
 </body>
</html>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案