Only enter 0-9 and include more than one 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" type="text/javascript">function clearNoNum(obj){ obj.value = obj.value.replace(/[^/d.]/g,""); //Clear characters other than "number" and "." obj.value = obj.value.replace(/^/./g,""); //Verify that the first character is a number instead of. obj.value = obj.value = obj.value.replace(//.{2,}/g,"."); //Retain only the first one. Clear the excess. obj.value = obj.value.replace(".","$#$").replace(//./g,"").replace("$#$",".");}</script></head><body>Text boxes that can only enter numbers and decimal points: <input name="input1" onkeyup="clearNoNum(this)"></body></html>The above text box can only enter the js code (including decimal points) of numbers. This is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.