Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function testeCampos(elemento) {
- //Recebe lista de campos para valida��o
- var camposArray = new Array();
- camposArray = elemento;
- //Recebe campo armazenado no array
- var campo, recFocu;
- //Verifica se h� uma ocorrencia de erro
- var faltaPre = false
- //varre o Array de Campos
- for (c = 0; c < camposArray.length; c++) {
- //cria Objeto com o metodo DOM
- campo = document.getElementById(camposArray[c]);
- if (campo.value == '') {
- campo.style.backgroundColor = "#eeee99";
- if (faltaPre != true) {
- faltaPre = true;
- recFocu = campo;
- }
- }
- else {
- campo.style.backgroundColor = "white";
- }
- }
- if (faltaPre == true) {
- alert('Campo com Preenchimento obrigatxf3rio!!!');
- recFocu.focus();
- return false;
- }
- else {
- return true;
- }
- }
- TextBox[] aTextbox = { txtNome, TxtEndereco, TxtCEP, TxtBairro, TxtUF, TxtCidade, TxtTelefone, txtUsuario, TxtSenha };
- this.btnEnviar.Attributes.Add("onclick", "return testeCampos(aTextbox);");
Add Comment
Please, Sign In to add comment