//MÁSCARA DE VALORES CAMPOS function txtBoxFormat(objeto, sMask, evtKeyPress) { var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla; if(document.all) { // Internet Explorer nTecla = evtKeyPress.keyCode; }else if(document.layers) { // Nestcape nTecla = evtKeyPress.which; }else{ nTecla = evtKeyPress.which; if (nTecla == 8 || nTecla == 9) { return true; } //exemplo // } sValue = objeto.value; // Limpa todos os caracteres de formatação que // já estiverem no campo. sValue = sValue.toString().replace( "-", "" ); sValue = sValue.toString().replace( "-", "" ); sValue = sValue.toString().replace( ".", "" ); sValue = sValue.toString().replace( ".", "" ); sValue = sValue.toString().replace( "/", "" ); sValue = sValue.toString().replace( "/", "" ); sValue = sValue.toString().replace( ":", "" ); sValue = sValue.toString().replace( ":", "" ); sValue = sValue.toString().replace( "(", "" ); sValue = sValue.toString().replace( "(", "" ); sValue = sValue.toString().replace( ")", "" ); sValue = sValue.toString().replace( ")", "" ); sValue = sValue.toString().replace( " ", "" ); sValue = sValue.toString().replace( " ", "" ); fldLen = sValue.length; mskLen = sMask.length; i = 0; nCount = 0; sCod = ""; mskLen = fldLen; while (i <= mskLen) { bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":")) bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " ")) if (bolMask) { sCod += sMask.charAt(i); mskLen++; } else { sCod += sValue.charAt(nCount); nCount++; } i++; } objeto.value = sCod; if (nTecla != 8 || nTecla != 9) { // backspace e tab if (sMask.charAt(i-1) == "9") { // apenas números... return ((nTecla > 47) && (nTecla < 58)); }else{ // qualquer caracter... return true; } }else{ return true; } } function testaForm(formulario) { var tipoData = /^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/; if(!tipoData.test(formulario.datanascimento.value)) { alert("O formato da data nao esta correto!"); return false; } var tipoEmail = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/; if(!tipoEmail.test(formulario.email.value)) { alert("O formato do e-mail nao esta correto!"); return false; } var tipoValor = /^\d{1,10}$/; if(!tipoValor.test(formulario.ultimosalario.value)) { alert("O formato do ultimo salario nao esta correto. O valor deve conter somente numeros!"); return false; } if(!tipoValor.test(formulario.pretensaosalarial.value)) { alert("O formato da pretensao salarial nao esta correto. O valor deve conter somente numeros!"); return false; } /*if(!tipoValor.test(formulario.conclusao.value)) { alert("O formato da conclusao nao esta correto. O valor deve conter somente numeros!"); return false; }*/ var charProibido = /^\"|\'|\!|\@|\#|\$|\%|\&|\*|\(|\)|\+|\=|\[|\{|\]|\}|\/|\?|\;|\:|\.|\>|\<|\|$/; if(formulario.nome.value == "" ){ alert("Voce deve preencher todos os campos obrigatorios!"); return false;}if(formulario.cpf.value == "" ){ alert("Voce deve preencher todos os campos obrigatorios!"); return false;}if(formulario.cidade.value == "" ){ alert("Voce deve preencher todos os campos obrigatorios!"); return false;}if(formulario.telefoneresidencial.value == "" ){ alert("Voce deve preencher todos os campos obrigatorios!"); return false;}if(formulario.telefonecelular.value == "" ){ alert("Voce deve preencher todos os campos obrigatorios!"); return false;} if(charProibido.test(formulario.indicacao.value) || charProibido.test(formulario.conhecido.value)) { alert("Alguns campos nao aceitam caracteres especiais!"); return false; } var charProibido = /^\"|\'|\!|\@|\#|\$|\%|\&|\*|\(|\)|\+|\=|\[|\{|\]|\}|\?|\;|$/; if(tipoValor.test(formulario.userfile.value)) { alert("O caminho do arquivo nao esta correto!"); return false; } return true; }