<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 value> <br><input name='txt1ōnchange="if(/D/.test(' 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="" if d this.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 .replace> <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 event.keycode>57) &&event.keyCode!=46 ||/.dd$/.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>