<div class="codetitle"> <span><a style="CURSOR: pointer" data="60236" class="copybut" id="copybut60236" onclick="doCopy('code60236')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code60236"> <br><input type="text" onkeyup="this.value=this.value.replace(/[^\.\d]/g,'');if(this.value.split('.').length>2){this.value=this.value.split('.')[0]+'.'+this.value.split('.')[1]}"> <br> </div> <br>1.文本框只能输入数字代码(小数点也不能输入) <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="51950" class="copybut" id="copybut51950" onclick="doCopy('code51950')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code51950"> <br><input> <br> </div> <br>2.只能输入数字,能输小数点. <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="29924" class="copybut" id="copybut29924" onclick="doCopy('code29924')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code29924"> <br><input> <br><input name="txt1ōnchange="if(/\D/.test(this.value)){alert(''只能输入数字'');this.value='''';}""> <br> </div> <br>3.数字和小数点方法二 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="69445" class="copybut" id="copybut69445" onclick="doCopy('code69445')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code69445"> <br><input type="text" t_value="" o_value=""> <br> </div> <br>4.只能输入字母和汉字 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="50882" class="copybut" id="copybut50882" onclick="doCopy('code50882')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code50882"> <br><input name="Numbers"> <br> </div> <br>5.只能输入英文字母和数字,不能输入中文 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="33128" class="copybut" id="copybut33128" onclick="doCopy('code33128')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code33128"> <br><input> <br> </div> <br>6.只能输入数字和英文 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="59832" class="copybut" id="copybut59832" onclick="doCopy('code59832')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code59832"> <br><input> <br> </div> <br>7.小数点后只能有最多两位(数字,中文都可输入),不能输入字母和运算符号: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="79722" class="copybut" id="copybut79722" onclick="doCopy('code79722')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code79722"> <br><input>57) &&event.keyCode!=46 ||/\.\d\d$/.test(value))event.returnValue=false"> <br> </div> <br>8.小数点后只能有最多两位(数字,字母,中文都可输入),可以输入运算符号: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="46610" class="copybut" id="copybut46610" onclick="doCopy('code46610')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code46610"> <br><input> <br> </div>