window.onload =function() { document.getElementById("input_num").oninput =function() { this.value =this.value.replace(/\s/g,‘‘).replace(/\D/g,‘‘).replace(/(\d{4})(?=\d)/g,"$1 ");; }; };
window.onload =function() { document.getElementById("input_num").oninput =function() { this.value =this.value.replace(/\s/g,‘‘).replace(/\D/g,‘‘).replace(/(\d{4})(?=\d)/g,"$1 ");; }; };
原文:http://www.cnblogs.com/weilantiankong/p/8030249.html