Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
将非数字字符替换成”” – 扎老铁
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
class="post-52864 post type-post status-publish format-standard hentry">

将非数字字符替换成””

<script>
function RepNumber(obj) {
            var reg = /^[\d]+$/g;
             if (!reg.test(obj.value)) {
                 var txt = obj.value;
                 txt.replace(/[^0-9]+/, function (char, index, val) {//匹配第一次非数字字符
                    obj.value = val.replace(/\D/g, "");//将非数字字符替换成""
                    var rtextRange = null;
                    if (obj.setSelectionRange) {
                        obj.setSelectionRange(index, index);
                    } else {//支持ie
                        rtextRange = obj.createTextRange();
                        rtextRange.moveStart('character', index);
                        rtextRange.collapse(true);
                        rtextRange.select();
                    }
                })
             }
         }
</script>

<input value="" type="text"  onkeyup="javascript:RepNumber(this)">
onkeyup="this.value = this.value.replace(/[^\d|\*|#|-]/ig, '')"

 

发表评论

电子邮件地址不会被公开。