qwe88,
<body onload="input.onkeyup()">
<input type="text" value="3432424" id="cif" />
<script>
var input = document.getElementById("cif");
input.onkeyup = input.onchange= input.onpaste = function(){
this.value= this.value.replace(/\s+/g, "").match(/(\d{1,3})(?=((\d{3})*([^\d]|$)))/g).join(" ");
};
</script></body>