前台金额校验
3 月,跳不动了?>>> < input type= "text" onblur= " value = value . replace ( /^\D*(\d*(?:\.\d{0,2})?).*$/g , '$1' ) " onkeyup= " value = value . replace ( /^\D*(\d*(?:\.\d{0,2})?).*$/g , '$1' ) " class= "layui-input" value= "" id= "money" name= "money" > var money = document . getElementById ( "money" ). value ; if ( money == null || money == "" || money == undefined ){ layer . msg ( "金额不能为空" ); return false ; } var regPos = /^\d+(\.\d+)?$/ ; //非负浮点数 // var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数 if ( regPos . test ( money )){ } 来源: