<html>
<head>
<title>js验证输入的金钱格式</title>
<script type="text/javascript">
    function moneyCheck(){
        var isNum = /^\d+(\.\d+)?$/;
        var money = document.getElementById("money").value;
        if(!isNum.test(money)){
            alert("请输入正确的金钱");
            return;
        }else{
            alert("输入正确");
        }
    }
  </script>
</head>

<body>
  <input >
  <button  onclick="moneyCheck();">验证</button>
 </body>
</html>

js验证输入的金钱格式

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2021-11-13
猜你喜欢
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
  • 2021-10-29
相关资源
相似解决方案