• 0
Sign in to follow this  
Guest Guest

Me Ajudem

Question

Guest Guest

tenho essa rotina..

function verifica()
{
if (document.frmreg.txtnome.value == ""){
  document.frmreg.txtnome.focus();
  alert('Informe seu nome.');
  return false;
}
else if (document[frmreg].txtemail.value == ""){
  document[frmreg].txtemail.focus();
  alert('Informe seu email');
  return false;
}
else if (document.frmreg.txtemail.value.match(/(\w+)@(.+)\.(\w+)$/) == null){
     document.frmreg.txtemail.focus();
     document.frmreg.txtemail.select();
     alert('Endereço de email inválido');
  return false;
}
else
{
  return true;
}
}
e no form:
<form name="frmreg" method="post" action="pagina.asp" onsubmit="return(verifica())">

só que nem está sendo executado nenhum teste quando eu clico no submit do meu form.. porque?

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

porque você não coloca o código abaixo no botão e não na tag form?

<form name="frmreg" method="post" action="pagina.asp" onsubmit="return(verifica())">

falou.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this