<input type = text class = txt name = qty value = onkeyup = this.Value = this.Value.replace (/[^0-9 /./ G, '')/>PS: JS implementation text boxes that can only enter numbers and decimal points
<html> <head> <meta http-equiv = content-type content = text/html; charSet = gb2312> <Title> JS can only enter numbers and decimal points </title> <Script Language = javascript T T T YPE = Text/JavaScript> Function Clearnonum (Obj) {obj.value = obj.value.replace (/[^/d.]/g,); // Clear numbers and. Value = obj.value.replace (/^// ./g,); // Verify that the first character is the number rather than. obj.value = obj.value.replace (//. {2,}/g ,.); Extra. Obj.value = obj.value.replace (., $#$). Replace (//./ g,). Replace ($#$ ,.);} </head> <body> <body > You can only enter the text box of numbers and decimal points: <input name = input1 onKeyup = Clearnonum (this)> </body> </html>The above is all the contents of this article. I hope that the content of this article will help everyone's learning or work. At the same time, I also hope that more support VEVB Wulin.com!