67
| <![CDATA[<script>
var mskFlag = "blank";
function strip(str, c) {
var tmp = str.split(c);
return tmp.join("");
}
function CNPJCPFMsk(aWidget) {
if (mskFlag === "getOut")
return true;
var tmp = strip(aWidget.value, ".");
tmp = strip(tmp, "/");
tmp = strip(tmp, "-");
var cont = 0;
var teste = '';
while (cont < tmp.length) {
if (!(tmp.charAt(cont) >= 0 && tmp.charAt(cont) <= 9 && tmp.charAt(cont) !== ' ')) {
teste += '';
}
else {
teste += tmp.charAt(cont);
}
cont++;
}
tmp = teste;
if (12 < tmp.length)
aWidget.value = tmp.substr(0, 2) + '.' + tmp.substr(2, 3) + '.' + tmp.substr(5, 3) + '/' + tmp.substr(8, 4) + '-' + tmp.substr(12, 2);
else if (9 < tmp.length)
aWidget.value = tmp.substr(0, 3) + '.' + tmp.substr(3, 3) + '.' + tmp.substr(6, 3) + '-' + tmp.substr(9, 3);
else if (6 < tmp.length)
aWidget.value = tmp.substr(0, 3) + '.' + tmp.substr(3, 3) + '.' + tmp.substr(6, 3);
else if (3 < tmp.length)
aWidget.value = tmp.substr(0, 3) + '.' + tmp.substr(3, 3);
else
aWidget.value = tmp;
}
function NumbersOnly(e) {//mascara somente numeros, libera copiar e colar
var aKey;
if (window.event)
aKey = e.keyCode;
else
aKey = e.which;
//if das teclas precionadas
if (!(((aKey === 67) && (e.ctrlKey)) || ((aKey === 86) && (e.ctrlKey)) || (aKey === 8) || (aKey === 9) || (aKey === 13) || (aKey === 16) || (aKey === 17) || (aKey === 92)
|| ((aKey >= 96) && (aKey <= 105)) || ((aKey >= 48) && (aKey <= 57)) || ((aKey >= 37) && (aKey <= 40)) || ((aKey >= 112) && (aKey <= 123)))) {
return false;
}
}
</script>]]>
|