ns4 = ( document.layers) ? true : false; ie4 = ( document.all ) ? true : false; function OnlyEspeciais(e) { var whichCode = (window.Event) ? e.which : e.keyCode; if (ie4 == true) { if (window.event.keyCode == 0 || window.event.keyCode == 8 || window.event.keyCode == 46 || window.event.keyCode == 45 || window.event.keyCode == 95 ) return true else if (window.event.keyCode >= 48 && window.event.keyCode <= 57) return true else if (window.event.keyCode >= 97 && window.event.keyCode <= 122) return true else window.event.keyCode = 0; } else { if (e.which == 0 || e.which == 8 || e.which == 45) return true else if (e.which >= 48 && e.which <= 57) return true else if (e.which >= 97 && e.which <= 122) return true else { e.preventDefault(); e.stopPropagation(); return false; } } } function validaData(str) { dia = (str.value.substring(0,2)); mes = (str.value.substring(3,5)); ano = (str.value.substring(6,10)); cons = true; // verifica se foram digitados n??os if (isNaN(dia) || isNaN(mes) || isNaN(ano)){ str.value = ""; str.focus(); return false; } // verifica o dia valido para cada mes if ((dia < 01)||(dia < 01 || dia > 30) && (mes == 04 || mes == 06 || mes == 09 || mes == 11 ) || dia > 31) { cons = false; } // verifica se o mes e valido if (mes < 01 || mes > 12 ) { cons = false; } // verifica se e ano bissexto if (mes == 2 && ( dia < 01 || dia > 29 || ( dia > 28 &&(parseInt(ano / 4) != ano / 4)))) { cons = false; } if (cons == false) { document.getElementById('data_erro_vazio').style.display = 'block'; str.value = ""; str.focus(); return false; } if (cons == true) { document.getElementById('data_erro_vazio').style.display = 'none'; } } // colocar no evento onKeyUp passando o objeto como parametro function formata(val) { var pass = val.value; var expr = /[0123456789]/; for(i=0; i3)) { val.value = ""; } } else if(i==1) { if (lchar.search(expr) != 0) { var tst1 = val.value.substring(0,(i)); val.value = tst1; continue; } if ((nchar != '/') && (nchar != '')) { var tst1 = val.value.substring(0, (i)+1); if(nchar.search(expr) != 0) var tst2 = val.value.substring(i+2, pass.length); else var tst2 = val.value.substring(i+1, pass.length); val.value = tst1 + '/' + tst2; } } else if(i==4){ if (lchar.search(expr) != 0) { var tst1 = val.value.substring(0, (i)); val.value = tst1; continue; } if ((nchar != '/') && (nchar != '')) { var tst1 = val.value.substring(0, (i)+1); if(nchar.search(expr) != 0) var tst2 = val.value.substring(i+2, pass.length); else var tst2 = val.value.substring(i+1, pass.length); val.value = tst1 + '/' + tst2; } } if (i>=6) { if (lchar.search(expr) != 0) { var tst1 = val.value.substring(0, (i)); val.value = tst1; } } } if (pass.length>10) val.value = val.value.substring(0, 10); return true; } // ESCREVE O SITE NA TELA function modifyText(id, text) { if (document.getElementById) { obj = document.getElementById(id); obj.childNodes[0].data = text; } } function left($string,$count) { $string = substr($string,0,$count); return $string; } function right($string,$count) { $string = substr($string, -$count, $count); return $string; }