Deividy Posted October 7, 2003 Report Share Posted October 7, 2003 eu só queria seber como faço para que um campo de telefone só receba numero sem que esse campo sejá obrigatoriocomo fazer isso Quote Link to comment Share on other sites More sharing options...
0 BigHead_o_rOx Posted October 7, 2003 Report Share Posted October 7, 2003 VEJA BEM DEIVIDY : SE VOCE FAZ UM LOCAL PRA COLOCAR UM TELEFONE A PESSOA SO VAI COOCAR NUMEROS...... :rolleyes: AI E SO COLOCAR O COMANDO : <INPUT TYPE=NAME NAME=TELEFONE>(ACHO NUNCA FIZ UM FORMULARIO :P ) Quote Link to comment Share on other sites More sharing options...
0 André Gusmão Posted October 7, 2003 Report Share Posted October 7, 2003 Faz assim:<input type="text" name="telefone" onKeyPress="return onlyNumbers()"><script language="JavaScript">function onlyNumbers(){ if(event.keyCode>=48 && event.keyCode<=57) return true; else return false;}</script>Certo?! ;) Quote Link to comment Share on other sites More sharing options...
0 PERNAMBUCO_FJV Posted October 7, 2003 Report Share Posted October 7, 2003 <html><script language="JavaScript"> <!-- function valida_fone(){ if(event.keyCode<48 || event.keyCode>57){ event.returnValue=false; } } --></script><body>Fone: <input type="text" name="fone" onkeypress="valida_fone()"></body></html> Quote Link to comment Share on other sites More sharing options...
0 PERNAMBUCO_FJV Posted October 7, 2003 Report Share Posted October 7, 2003 você pode usar a função isNAN<html><script language="JavaScript"> <!-- function valida_fone(edit){ if(isNaN(edit.value)){ edit.value=""; } } --></script><body>Fone: <input type="text" name="fone" onkeyup="valida_fone(this)"></body></html> Quote Link to comment Share on other sites More sharing options...
0 Deividy Posted October 7, 2003 Author Report Share Posted October 7, 2003 obrigado a todos já deu certo com o e-mail como seria... :D Quote Link to comment Share on other sites More sharing options...
0 PERNAMBUCO_FJV Posted October 7, 2003 Report Share Posted October 7, 2003 isso é uma pergunta?? Quote Link to comment Share on other sites More sharing options...
0 Deividy Posted October 7, 2003 Author Report Share Posted October 7, 2003 é você pode me ajuda Quote Link to comment Share on other sites More sharing options...
0 PERNAMBUCO_FJV Posted October 7, 2003 Report Share Posted October 7, 2003 script language= "JavaScript">function isEmail2(email){if (email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {alert("Erro!");email.focus();return false;}return true;}</script><html><head><title>Teste Funcao Ismail</title></head><body><form method="POST" name="tstmail" action="seila.htm" onsubmit="return isEmail2(document.tstmail.mail);"><input type="text" name="mail" size="50"><input type="submit" value="Envia" name="tst1"><input type="reset" value="limpa" name="tst2"></form></body></html>O jissa quem fez!! Quote Link to comment Share on other sites More sharing options...
Question
Deividy
eu só queria seber como faço para que um campo de telefone só receba numero
sem que esse campo sejá obrigatorio
como fazer isso
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.