js只能输入数字和小数点的正则

 1 <html>
 2     <head>
 3         <meta charset="UTF-8">
 4         <title>document</title>
 5     </head>
 6     <body>
 7         <form>
 8             <input type="text" autocomplete="off" id="price" autofocus="autofocus" onkeyup="value=value.replace(/[^\d^\.]+/g,'')">>
 9         </form>
10     </body>
11 </html>

 

posted @ 2022-11-23 18:35  鸾姝淡月  阅读(1196)  评论(0)    收藏  举报