Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

LoryBeta

ErrO no Codigo

Recommended Posts

<html>

<head>

<title>Trabalho de Programacao para WEB</title>

<script>

 

v = new Array()

j = 0;

 

function validacao() {

n= f.nome.value;

t= f.tel.value;

e= f.email.value;

m= f.mes.value;

d= f.dia.value;

c=f.cpf.value;

x = 0;

 

if (n == ""){

alert("Preencha o campo NOME");

f.nome.focus();

x = 1;

}

if (t.length < 8){

alert("Preencha o campo TELEFONE");

f.tel.focus();

x = 1;

}

 

if ( e.indexOf('@')== -1 || e.indexOf('.')==-1 ) {

alert('Campo Email INVALIDO');

f.email.focus();

f.email.value="";

x = 1;

}

 

 

if (d != ""){

if (eval(d)>31){

alert(' O dia digitado esta errado');

f.dia.focus();

f.dia.value="";

x = 1;

}

}

if (m != ""){

if(eval(m)>12){

alert('O mes digitado esta errado');

f.mes.focus();

f.mes.value="";

x = 1;

}

}

if (x == 0)

incluirVetor(frm.nome.value,frm.cpf.value,frm.email.value,frm.site.value,frm.endereco.value,frm.bairro.value,frm.cidade.value,frm.cep.value,frm.estado.value,frm.turma.value,frm.dia.value,frm.mes.value,frm.ano.value,frm.tel.value,frm.sexo.value);

 

}

 

function campos(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15) {

this.nome = c1;

this.cpf = c2;

this.email = c3;

this.site = c4;

this.endereco = c5;

this.bairro = c6;

this.cidade = c7;

this.cep = c8;

this.estado = c9;

this.turma = c10;

this.dia = c11;

this.mes = c12;

this.ano = c13;

this.tel = c14;

this.sexo = c15;

}

 

function incluirVetor(nome, cpf, email, site, endereco, bairro, cidade, cep, estado, turma, dia, mes, ano, tel, sexo) {

v[j] = new campos(nome, cpf, email, site, endereco, bairro, cidade, cep, estado, turma, dia, mes, ano, tel, sexo);

j++;

}

 

function visualizar() {

aux = "";

for(i=0; i<v.length; i++) {

aux += "NOME: " + v.nome + " CPF: " + v.cpf + " EMAIL : " + v.email + " WEBSITE : " +

v.site + " ENDEREÇO : " + v.endereco + " BAIRRO : " + v.bairro + " CIDADE : " + v.cidade +

" CEP : " + v.cep + " ESTADO : " + v.estado + " TURMA : " + v.turma + " DATA : " + v.dia + "/" + v.mes + "/" + v.ano +

" TELEFONE : " + v.tel + " SEXO : " + v.sexo + "<br><br>";

}

//janela = window.open("", "JANELA", "height = 300, width = 400, scrollbars = yes, menubar=yes, toolbar = no");

janela = window.open();

janela.document.write(aux);

 

}

 

 

function incluir(){

pos = f.bairro.options.length++;//Incrementa a posição do vetor

f.bairro.options[pos].text = f.bar.value;

f.bar.value="";

f.bar.focus();

 

 

}

function incluir3(){

pos3 = f.estado.options.length++;//Incrementa a posição do vetor

f.estado.options[pos3].text = f.est.value;

f.est.value="";

f.est.focus();

 

 

}

function incluir4(){

pos4 = f.turma.options.length++;//Incrementa a posição do vetor

f.turma.options[pos4].text = f.tur.value;

f.tur.value="";

f.tur.focus();

 

 

}

function incluir2(){

pos2 = f.cidade.options.length++;//Incrementa a posição do vetor

f.cidade.options[pos2].text = f.cid.value;

f.cid.value="";

f.cid.focus();

 

 

}

function amarelo(texto){

texto.style.background ="#FFFF00";

}

 

function branco(texto){

texto.style.background ="#ffffff";

}

 

 

</script>

<center>

 

</center>

<head>

 

<body>

<BODY BGCOLOR="#FF1493" TEXT="#0000FF" LINK="#FFFF00">

</head>

<form name="f">

 

<center>

<blockquote>

<table>

 

<tr>

<td>Nome Completo*:</td>

<td colspan="3"><input type="text" size="50" name="nome" onfocus="amarelo(this)" onblur="branco(this)" ></td>

</tr>

<tr>

<td>CPF</td>

<td colspan="3"> <input type="text" MAXLENGTH="11" name="cpf" onfocus="amarelo(this)" onblur="branco(this)" ></td>

 

 

</tr>

<tr>

<td>Email*</td>

 

<td colspan="3"> <input type="text" size="50" name="email" onfocus="amarelo(this)" onblur="branco(this)" ></td>

</tr>

<tr>

<td>Website</td>

 

<td colspan="3"> <input type="text"size="50" name="site" onfocus="amarelo(this)" onblur="branco(this)"></td>

 

</tr>

<tr>

<td>Endereço</td>

 

<td colspan="3"> <input type="text" size="20" name="end"onfocus="amarelo(this)" onblur="branco(this)"></td>

</tr>

 

<tr>

<td>Bairros</td>

<td><select name="bairro" style ="width : 150px">

</select></td>

<td><input type="text" name="bar" onfocus="amarelo(this)" onblur="branco(this)"></td>

 

<td><input type="button" onclick="incluir()" value="+"></td>

 

</TR>

<TR>

<td>Cidade</td>

<td><select name="cidade" style ="width : 140px" >

</select></td>

<td><input type="text" name="cid" onfocus="amarelo(this)" onblur="branco(this)"></td>

<td><input type="button" onclick="incluir2()" value="+"></td>

 

</tr>

 

<tr>

<td>CEP</td>

<td><input type="text" size="20" name="cep"onfocus="amarelo(this)" onblur="branco(this)"></td>

</tr>

<tr>

 

<td>Estado</td>

<td><select name="estado" style ="width : 50px">

</select></td>

<td><input type="text" name="est" onfocus="amarelo(this)" onblur="branco(this)"> </td>

 

<td><input type="button" onclick="incluir3()" value="+"></td>

 

</tr>

</tr>

<tr>

<td>Turma</td>

<td> <select name="turma" style ="width : 50px">

</td><td><input type="text" name="tur" onfocus="amarelo(this)" onblur="branco(this)"></td>

<td><input type="button" onclick="incluir4()" value="+">

</tr>

<tr>

 

<td>Data de Nasc.</td>

<td>

<input type="text" maxlength="2" size="2" name="dia" onfocus="amarelo(this)" onblur="branco(this)"> /

<input type="text" maxlength="2" size="2" name="mes"onfocus="amarelo(this)" onblur="branco(this)"> /

<input type="text" maxlength="4" size="4" name="ano" onfocus="amarelo(this)" onblur="branco(this)"></td>

<br><br></tr>

<tr>

<td>Telefone*</td>

<td> <input type="text" size="20" name="tel" onfocus="amarelo(this)" onblur="branco(this)"></td><tr>

 

 

<td>Sexo</td>

<td> <input type="radio" value="F" name="sexo" >Feminino

<input type="radio" value="M" name="sexo" >Masculino</td>

</TR>

<tr>

<td colspan = "5"><input type = "button" value = "Gravar" onclick="validacao()">

<input type = "reset" value = "Limpar">

<input type="button" onclick="visualizar()"value="Visualizar"></td>

 

</tr></p>

<td><p align="justify"></td>

<tr><td><a href="voltar">Voltar</a></td></tr>

</center></p>

</table>

</font>

</form>

</body>

 

</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.