Salve galera, estou com um problema em um código asp que executa o JS para autenticação de campos, o problema é que no IE funciona direitinho todos os campos obrigatórios, mas no FF não funciona, poderiam me ajudar? vou postar o código por completo, mas o que vai interessar a vocês é o JS logo no inicio. grato
<%
'Email para onde serão enviados os dados do formulário
email_form = "portal@.com.br"
'Título do email
assunto_form = "Fale Conosco - Dúvidas"
'Servidor de email
servidor = "smtp.portal.com.br"
'Componente para envio do email: CDONTS | AspMail | AspEmail | AspQmail
componente = "CDONTS"
'Cabeçalho do texto do email recebido
cabecalho_email = "Dúvida enviada pelo portal"
'*******************************************************************
%>
<HTML>
<HEAD>
<TITLE>Fale Conosco</TITLE>
<meta name="robots" content="ALL">
<style type="text/css">
<!--
.campo_alerta { font-family: Tahoma, Verdana, Arial; font-size: 11px; background-color:
#E0E0E0; border: 1px solid #000000 }
.texto_pagina { font-family: Arial; font-size: 11px; color: #000000 }
.tabela_formulario
{
width: 200;
background-color: white;
}
.titulo_campos { font-family: arial; font-size: 11px; color: #000000; background-color: #FFFFFF }
.campos_formulario { font-family: arial; font-size: 11px; color: #000000; background-color: #FFFFFF;
border-style: solid; border-width: 1px }
-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
function abre_janela(width, height, nome) {
var top; var left;
top = ( (screen.height/2) - (height/2) )
left = ( (screen.width/2) - (width/2) )
window.open('',nome,'width='+width+',height='+height+& #39;,scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=no,left
='+left+',top='+top);
}
function recebe_imagem(campo, imagem){
var foto = 'img_' + campo
document.form_incluir[campo].value = imagem;
document.form_incluir[foto].src = imagem;
}
function verifica_form(form) {
var passed = false;
var ok = false
var campo
for (i = 0; i < form.length; i++) {
campo = form[i].name;
if (form[i].df_verificar == "sim") {
if (form[i].type == "text" | form[i].type == "textarea" | form[i].type == "select-one") {
if (form[i].value == "" | form[i].value == "http://") {
form[campo].className='campo_alerta'
form[campo].focus();
alert("Preencha corretamente o campo");
return passed;
stop;
}
}
else if (form[i].type == "radio") {
for (x = 0; x < form[campo].length; x++) {
ok = false;
if (form[campo][x].checked) {
ok = true;
break;
}
}
if (ok == false) {
form[campo][0].focus();
form[campo][0].select();
alert("Informe uma das opcões");
return passed;
stop;
}
}
var msg = ""
if (form[campo].df_validar == "cpf") msg = checa_cpf(form[campo].value);
if (form[campo].df_validar == "cnpj") msg = checa_cnpj(form[campo].value);
if (form[campo].df_validar == "cpf_cnpj") {
msg = checa_cpf(form[campo].value);
if (msg != "") msg = checa_cnpj(form[campo].value);
}
if (form[campo].df_validar == "email") msg = checa_email(form[campo].value);
if (form[campo].df_validar == "numerico") msg = checa_numerico(form[campo].value);
if (msg != "") {
if (form[campo].df_validar == "cpf_cnpj") msg = "informe corretamente o número do CPF ou CNPJ";
form[campo].className='campo_alerta'
form[campo].focus();
form[campo].select();
alert(msg);
return passed;
stop;
}
}
}
passed = true;
return passed;
}
function desabilita_cor(campo) {
campo.className='campos_formulario'
}
function checa_numerico(String) {
var mensagem = "Este campo aceita somente números"
var msg = "";
if (isNaN(String)) msg = mensagem;
return msg;
}
function checa_email(campo) {
var mensagem = "Informe corretamente o email"
var msg = "";
var email = campo.match(/(\w+)@(.+)\.(\w+)$/);
if (email == null){
msg = mensagem;
}
return msg;
}
function checa_cpf(CPF) {
var mensagem = "informe corretamente o número do CPF"
var msg = "";
if (CPF.length != 11 || CPF == "00000000000" || CPF == "11111111111" ||
CPF == "22222222222" || CPF == "33333333333" || CPF == "44444444444" ||
CPF == "55555555555" || CPF == "66666666666" || CPF == "77777777777" ||
CPF == "88888888888" || CPF == "99999999999")
msg = mensagem;
soma = 0;
for (y=0; y < 9; y ++)
soma += parseInt(CPF.charAt(y)) * (10 - y);
resto = 11 - (soma % 11);
if (resto == 10 || resto == 11)resto = 0;
if (resto != parseInt(CPF.charAt(9)))
msg = mensagem; soma = 0;
for (y = 0; y < 10; y ++)
soma += parseInt(CPF.charAt(y)) * (11 - y);
resto = 11 - (soma % 11);
if (resto == 10 || resto == 11) resto = 0;
if (resto != parseInt(CPF.charAt(10)))
msg = mensagem;
return msg;
}
function checa_cnpj(s) {
var mensagem = "informe corretamente o número do CNPJ"
var msg = "";
var y;
var c = s.substr(0,12);
var dv = s.substr(12,2);
var d1 = 0;
for (y = 0; y < 12; y++)
{
d1 += c.charAt(11-y)*(2+(y % 8));
}
if (d1 == 0) msg = mensagem;
d1 = 11 - (d1 % 11);
if (d1 > 9) d1 = 0;
if (dv.charAt(0) != d1)msg = mensagem;
d1 *= 2;
for (y = 0; y < 12; y++)
{
d1 += c.charAt(11-y)*(2+((y+1) % 8));
}
d1 = 11 - (d1 % 11);
if (d1 > 9) d1 = 0;
if (dv.charAt(1) != d1) msg = mensagem;
return msg;
}
function mascara_data(data){
var mydata = '';
mydata = mydata + data;
if (mydata.length == 2){
mydata = mydata + '/';
}
if (mydata.length == 5){
mydata = mydata + '/';
}
return mydata;
}
function verifica_data(data) {
if (data.value != "") {
dia = (data.value.substring(0,2));
mês = (data.value.substring(3,5));
ano = (data.value.substring(6,10));
situacao = "";
if ((dia < 01)||(dia < 01 || dia > 30) && ( mês == 04 || mês == 06 || mês == 09 || mês == 11 ) || dia > 31) {
situacao = "falsa";
}
if (mês < 01 || mês > 12 ) {
situacao = "falsa";
}
if (mês == 2 && ( dia < 01 || dia > 29 || ( dia > 28 && (parseInt(ano / 4) != ano / 4)))) {
situacao = "falsa";
}
if (situacao == "falsa") {
data.focus();
data.select();
alert("Data inválida!");
}
}
}
//-->
</script>
<link href="../assets/portal.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY class=texto_pagina>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<%
If Not IsEmpty(Request.Form) Then
strMsg = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>"
strMsg = strMsg & "<HTML><HEAD>"
strMsg = strMsg & "<META content='text/html; charset=iso-8859-1' http-equiv=Content-Type>"
strMsg = strMsg & "<META content='MSHTML 5.00.2614.3500' name=GENERATOR></HEAD>"
strMsg = strMsg & "<BODY><FONT face=Tahoma size=2><B>" & cabecalho_email & "</B><BR><BR>"
strMsg = strMsg & "<B>Nome:</B><BR><BR>" & Trim(Request.Form("Campo1")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>e-mail:</B><BR><BR>" & Trim(Request.Form("Campo3")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Telefone:</B><BR><BR>" & Trim(Request.Form("Campo2")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Celular:</B><BR><BR>" & Trim(Request.Form("Campo4")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Segmento Desejado:</B><BR><BR>" & Trim(Request.Form("Campo5")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Tipo da transação:</B><BR><BR>" & Trim(Request.Form("Campo6")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Tipo do evento:</B><BR><BR>" & Trim(Request.Form("Campo7")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Endereço da instituição:</B><BR><BR>" & Trim(Request.Form("Campo8")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Complemento:</B><BR><BR>" & Trim(Request.Form("Campo9")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Bairro:</B><BR><BR>" & Trim(Request.Form("Campo11")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>CEP:</B><BR><BR>" & Trim(Request.Form("Campo10")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Cidade:</B><BR><BR>" & Trim(Request.Form("Campo12")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Estado:</B><BR><BR>" & Trim(Request.Form("Campo13")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "<B>Mensagem:</B><BR><BR>" & Trim(Request.Form("Campo14")) & "<HR size=1 color=gainsboro>"
strMsg = strMsg & "</FONT></BOBY>"
strMsg = strMsg & "</HTML>"
strResposta = "<html>"
strResposta = strResposta & "<head><meta http-equiv=""Content-Type"" content=""text/html;""><link href=""http://www.ubiqua.com.br/assets/faleconosco_tabela.css"" rel=""stylesheet"" type=""text/css""></head>"
strResposta = strResposta & "<body bgcolor=""#f4f4f4""><div align=""center""><center>"
strResposta = strResposta & "<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""600"">"
strResposta = strResposta & "</table>"
strResposta = strResposta & "</center>"
strResposta = strResposta & "</div>"
strResposta = strResposta & "<br><br><font class=""textBoldColor"" size=""2"">Prezado(a) cliente, este e-mail confirma o recebimento de suas <font class=""textColor"" size=""2"">Dúvidas <font class=""textBoldColor"" size=""2"">enviadas pelo suporte on-line. Em breve um de nossos consultores entrará em contato informando a ação realizada."
strResposta = strResposta & "<br><br><font class=""textBoldColor"" size=""2""><i>Muito obrigado</i>,"
strResposta = strResposta & "<br><br><font class=""textColor"" size=""2""><i>Equipe de atendimento e relacionamento ao cliente.</i>"
strResposta = strResposta & "</body></html>"
destino = request.form("campo3")
EnviaEmail servidor, componente, email_form, email_form, destino, assunto_form, strMsg, strResposta
Function EnviaEmail(Host,Componente,Email,NomeEmail,ParaEmail,Assunto,Mensagem,Resposta)
Select Case Componente
Case "AspMail"
on error resume next
Set eObjMail = Server.CreateObject("SMTPsvg.Mailer")
eObjMail.FromName = NomeEmail
eObjMail.FromAddress = Email
eObjMail.RemoteHost = Host
eObjMail.AddRecipient "", ParaEmail
eObjMail.Subject = Assunto
eObjMail.ContentType = "text/html"
eObjMail.BodyText = Mensagem
eObjMail.SendMail
Set eObjMail = nothing
Case "AspEmail"
on error resume next
Set eObjMail = Server.CreateObject("Persits.MailSender")
eObjMail.Host = Host
eObjMail.From = Email
eObjMail.FromName = NomeEmail
eObjMail.AddReplyTo Email
eObjMail.AddAddress ParaEmail
eObjMail.Subject = Assunto
eObjMail.isHTML = true
eObjMail.Body = Mensagem
eObjMail.Send
Set eObjMail = nothing
Case "AspQmail"
on error resume next
Set eObjMail = Server.CreateObject("SMTPsvg.Mailer")
eObjMail.QMessage = 1
eObjMail.FromName = NomeEmail
eObjMail.FromAddress = Email
eObjMail.RemoteHost = Host
eObjMail.AddRecipient "", ParaEmail
eObjMail.Subject = Assunto
eObjMail.BodyText = Mensagem
objNewMail.SendMail
Set eObjMail = nothing
Case "CDONTS"
on error resume next
Set eObjMail = Server.CreateObject("CDONTS.NewMail")
eObjMail.to = ParaEmail
eObjMail.from = NomeEmail & "<" & Email & ">"
eObjMail.subject = Assunto
eObjMail.Importance = 1
eObjMail.BodyFormat = 0
eObjMail.MailFormat = 0
eObjMail.body = Resposta
eObjMail.send
Set eObjMail = nothing
Set eObjMail = Server.CreateObject("CDONTS.NewMail")
eObjMail.to = NomeEmail & "<" & Email & ">"
eObjMail.from = ParaEmail
eObjMail.subject = Assunto
eObjMail.Importance = 1
eObjMail.BodyFormat = 0
eObjMail.MailFormat = 0
eObjMail.body = Mensagem
eObjMail.send
Set eObjMail = nothing
End Select
End Function
%>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<font face="Arial">
<img border="0" src="../assets/emailenviado.gif" width="408" height="307">
<%
Else
%>
</font></p>
<form name="form_incluir" method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>" onsubmit="return verifica_form(this);">
<p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><img border="0" src="../assets/camposobrigatorios.gif"></p>
<TABLE border=0 cellpadding=2 cellspacing=1 class=tabela_formulario width="100%" height="635">
<TR class=titulo_campos><TD valign="top" width="100%" height="22">
<p align="left"><img border="0" src="../assets/barra_atendimentousuario.gif"> </p>
</TD><TD valign="middle" width="100%" height="22">
<p align="left">
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Nome:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=200" type="text" name="Campo1" maxlength="60" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">e-mail:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=150" type="text" name="Campo3" maxlength="70" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" df_validar="email" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Telefone:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=100" type="text" name="Campo2" maxlength="12" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Celular:
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=150" type="text" name="Campo4" maxlength="12" value="" onKeyPress="desabilita_cor(this)" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="28">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left"> <img border="0" src="../assets/barra_atendimentodados.gif">
</TD><TD valign="middle" width="100%" height="28">
<p align="left">
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Segmento
desejado:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<SELECT style="width=150" name="Campo5" df_verificar="sim" onChange="desabilita_cor(this)" class=campos_formulario>
<OPTION value=""></OPTION>
<OPTION value="Evento Artístico">Evento Artístico</OPTION>
<OPTION value="Evento Corporativo">Evento Corporativo</OPTION>
<OPTION value="Formaturas">Formaturas</OPTION>
<OPTION value="Evento Promocional">Evento Promocional</OPTION>
</SELECT>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="31">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Tipo de transação:*
</TD><TD width="100%" height="31">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<input type="radio" name="Campo6" value="Orçamento" df_verificar="sim">
Orçamento <input type="radio" name="Campo6" value="Locação" df_verificar="sim">Locação </p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left"> </p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="31">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Tipo do evento:*
</TD><TD width="100%" height="31">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<input type="radio" name="Campo7" value="Aberto" df_verificar="sim">
Aberto<input type="radio" name="Campo7" value="Fechado" df_verificar="sim">Fechado </p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left"> </p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Endereço da
instituição:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=200" type="text" name="Campo8" maxlength="150" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Complemento:
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=100" type="text" name="Campo9" maxlength="70" value="" onKeyPress="desabilita_cor(this)" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Bairro:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=150" type="text" name="Campo11" maxlength="70" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">CEP:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=100" type="text" name="Campo10" maxlength="9" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Cidade:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=150" type="text" name="Campo12" maxlength="70" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Estado:*
</TD><TD width="100%" height="25">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<INPUT style="width=150" type="text" name="Campo13" maxlength="50" value="" onKeyPress="desabilita_cor(this)" df_verificar="sim" class=campos_formulario>
</p>
</TD></TR>
<TR class=titulo_campos><TD valign="top" width="100%" height="152">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">Mensagem:*
</TD><TD width="100%" height="152">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<TEXTAREA name="Campo14" df_verificar="sim" onKeyPress="desabilita_cor(this)" class=campos_formulario rows="6" cols="35"></TEXTAREA>
</p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left"> </p>
</TD></TR>
</TABLE>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0" align="left">
<input type="submit" name="submit" value="Enviar" class=textBoldColor style="font-family: arial; font-size: 11">
</form>
<%
End If
%>
</BODY>
</HTML>