Ir para conteúdo

POWERED BY:

Arquivado

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

marvi

Script para validar forumlário

Recommended Posts

Olá pessoal,

 

Tenho um script de validação de formulário, que manda preencher os campos vazios antes de enviar, submeter e ele funciona bem no internet explorer, mas no Fire Fox ele chega a funcionar bem, avisa que tem que preencher um determinado campo, mas em vez dele ficar na página do formulário ele acaba enviando o formulário mesmo assim.

 

No internet explorer ele dar um alerta mandando preencher um campo vazio do formulário.

 

Já no Fire Fox ele dar um alerta também mandando preencher um campo vazio do formulário, mas depois do alerta acaba enviando o formulário mesmo assim e o certo é não enviar, só alertar.

 

O que deve ser? Veja meu script:

 

function ValidaFormulario()
{
  if (document.form.data_agenda.value==""){ 
		alert("Informe a data para o agendamento");  
		document.form.data_agenda.focus(); 
	event.returnValue=false;return false;
}
 if (document.form.hora_agenda.value==""){ 
		alert("Informe a hora para o agendamento");  
		document.form.hora_agenda.focus(); 
	event.returnValue=false;return false;
}

	 if(document.form.medicamento[0].checked)
	{
	
	 if ((document.form.medicamentosres.value=="") || (document.form.medicamentosres.value=="Qual(is) medicamento(s)?") ){ 
		alert("Informe o medicamento");  
		//document.form.medicamentosres.focus(); 
	event.returnValue=false;return false;
	}
return false;

	  
	}
}
			</script>

Desde já, agradeço!

 

Marcelo

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ok, o form é grande e cheio de função:

 

<form method="POST" action="sistemaonlineinsert.asp" name="form" onSubmit="ValidaFormulario();">
	  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber22" height="22">
		<tr>
		  <td width="100%" bgcolor="#F2F8FD" height="22">
		  <span style="font-weight: 700">
		  <font face="Verdana" style="font-size: 9pt" color="#422A09">Dados 
		  pessoais:</font></span></td>
		</tr>
	  </table>
	  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber25">
		<tr>
		  <td width="100%">
		  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber26">
			<tr>
			  <td width="32%">
			  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="106%" id="AutoNumber27">
				<tr>
				  <td width="100%">
		  <font face="Arial Narrow" size="2" color="#696969">Nome completo:</font></td>
				</tr>
				<tr>
				  <td width="100%"><font face="verdana" color="#422a09" size="-2">
				  <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="100" size="51" name="nome" value="<%=session("nome")%>"></font><font face="Arial" color="#FFFFFF" size="-2">.</font></td>
				</tr>
			  </table>
			  </td>
			  <td width="10%">
			  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber28">
				<tr>
				  <td width="100%">
		  <font face="Arial Narrow" size="2" color="#696969">RG:</font></td>
				</tr>
				<tr>
				  <td width="100%"><font face="verdana" color="#422a09" size="-2">
				  <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="100" size="19" name="rg" value="<%=session("rg")%>"></font></td>
				</tr>
			  </table>
			  </td>
			  <td width="15%">
		  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber11">
			<tr>
			  <td width="59%">
			  <font face="Arial Narrow" color="#696969" size="2">Data de 
			  nascimento:</font></td>
			  <td width="41%" valign="bottom">
			  <p align="right"><font face="Verdana" size="1" color="#FF0000">  
			   
			  </font></td>
			</tr>
			<tr>
			  <td width="100%" colspan="2">
			  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber13" height="1">
				<tr>
				  <td width="20%" height="1" valign="top">
				  <select style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" name="dia_nascimento">

<% if session("dia_nascimento") <> "" then%>
<option value="<%=session("dia_nascimento")%>"><%=session("dia_nascimento")%></option>
<% end if%>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7" >7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select></td>
				  <td width="40%" height="1" valign="top">
				  <p align="center">
				  <select style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" name="mes_nascimento">
<% if session("mes_nascimento") <> "" then%>
<option value="<%=session("mes_nascimento")%>"><%=session("mes_nascimento")%></option>
<% end if%>

<option  >Janeiro</option>
<option  >Fevereiro</option>
<option  >Março</option>
<option  >Abril</option>
<option  >Maio</option>
<option >Junho</option>
<option  >Julho</option>
<option >Agosto</option>
<option  >Setembro</option>
<option  >Outubro</option>
<option  >Novembro</option>
<option  >Dezembro</option>
</select></td>
				  <td width="40%" height="1" valign="top">
				  <p align="center"><font face="verdana" color="#422a09" size="-2">
			
				  </font>
				  <select style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" name="ano_nascimento">

<% if session("dia_nascimento") <> "" then%>
<option value="<%=session("dia_nascimento")%>"><%=session("dia_nascimento")%></option>
<% end if%>
 <%	IF rsano.EOF then %>

					 <option>Não há ano</option>
<%  else
											  rsano.MoveFirst 
											  

											if not rsano.eof then
												do while not rsano.eof 
										%>
					 <option value="<%=rsano("ano")%>"><%=rsano("ano")%></option>
					<% 		rsano.MoveNext
										   		loop
										   		
										   		 end if
										   		 										   		 end if
									%>
</select></td>
				</tr>
			  </table>
			  </td>
			</tr>
		  </table>
			  </td>
			  <td width="15%">
		  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber12" height="17">
			<tr>
			  <td width="100%" height="1"><font face="Arial Narrow" size="2" color="#696969">
		   Nome do convênio:</font></td>
			</tr>
			<tr>
			  <td width="100%" height="16"><font face="verdana" color="#422a09" size="-2">
				   <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="100" size="20" name="nome_convenvio" value="<%=session("nome_convenvio")%>"></font></td>
			</tr>
		  </table>
			  </td>
			</tr>
		  </table>
		  </td>
		</tr>
	  </table>
	  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber2">
		<tr>
		  <td width="16%">
		  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber14">
			<tr>
			  <td width="100%">
			  <font face="Arial Narrow" color="#696969" size="2">
			  Matrícula do convênio:</font></td>
			</tr>
			<tr>
			  <td width="100%"><font face="verdana" color="#422a09" size="-2">
				  <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="100" size="27" name="matricula" value="<%=session("matricula")%>"></font></td>
			</tr>
		  </table>
		  </td>
		  <td width="33%"><font face="Arial Narrow" color="#696969" size="2">
		  <table id="AutoNumber11" style="BORDER-COLLAPSE: collapse" borderColor="#111111" cellSpacing="0" cellPadding="0" width="100%" border="0">
			<tr>
			  <td width="76%"><font face="Arial Narrow" size="2" color="#696969">
		  Validade da carteira do  </font>
			  <font face="Arial Narrow" color="#696969">convênio</font><font face="Arial Narrow" size="2" color="#696969">:</font></td>
			  <td vAlign="bottom" width="24%">
			  <p align="center"><font face="Verdana" color="#ff0000" size="1">
			  Ex: 1981</font></td>
			</tr>
			<tr>
			  <td width="100%" colSpan="2">
			  <table id="AutoNumber13" style="BORDER-COLLAPSE: collapse" borderColor="#FFFFFF" height="1" cellSpacing="0" cellPadding="0" width="100%" border="1">
				<tr>
				  <td vAlign="top" width="14%" height="1">
				  <font face="Arial Narrow" color="#696969" size="2">
				  <select style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" name="data_validade">
<% if session("data_validade") <> "" then%>
<option value="<%=session("data_validade")%>"><%=session("data_validade")%></option>
<% end if%>

				  <option value="1">1</option>
				  <option value="2">2</option>
				  <option value="3">3</option>
				  <option value="4">4</option>
				  <option value="5">5</option>
				  <option value="6">6</option>
				  <option value="7">7</option>
				  <option value="8">8</option>
				  <option value="9">9</option>
				  <option value="10">10</option>
				  <option value="11">11</option>
				  <option value="12">12</option>
				  <option value="13">13</option>
				  <option value="14">14</option>
				  <option value="15">15</option>
				  <option value="16">16</option>
				  <option value="17">17</option>
				  <option value="18">18</option>
				  <option value="19">19</option>
				  <option value="20">20</option>
				  <option value="21">21</option>
				  <option value="22">22</option>
				  <option value="23">23</option>
				  <option value="24">24</option>
				  <option value="25">25</option>
				  <option value="26">26</option>
				  <option value="27">27</option>
				  <option value="28">28</option>
				  <option value="29">29</option>
				  <option value="30">30</option>
				  <option value="31">31</option>
				  </select></font></td>
				  <td vAlign="top" width="43%" height="1">
				  <p align="center">
				  <font face="Arial Narrow" color="#696969" size="2">
				  <select style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" name="mes_validade">
<% if session("mes_validade") <> "" then%>
<option value="<%=session("mes_validade")%>"><%=session("mes_validade")%></option>
<% end if%>
				  <option >Janeiro</option>
				  <option >Fevereiro</option>
				  <option >Março</option>
				  <option >Abril</option>
				  <option >Maio</option>
				  <option >Junho</option>
				  <option >Julho</option>
				  <option >Agosto</option>
				  <option >Setembro</option>
				  <option >Outubro</option>
				  <option >Novembro</option>
				  <option >Dezembro</option>
				  </select></font></td>
				  <td vAlign="top" width="68%" height="1">
				  <p align="center">
				  <font face="verdana" color="#422a09" size="-2">
				  <% if session("ano_validade") = "" then%>
				  <input class="formcolor" style="font-size: 10px; font-family: Verdana; float: left; border: 1px solid #7b7a64" onfocus="this.value=''" maxLength="100" size="16" value="Digite o ano" name="ano_validade">
				  <%else%>
				  <input class="formcolor" style="font-size: 10px; font-family: Verdana; float: left; border: 1px solid #7b7a64" onfocus="this.value=''" maxLength="100" size="16" value="<%=session("ano_validade")%>" name="ano_validade">
				  <%end if%>
				  </font></td>
				</tr>
			  </table>
			  </td>
			</tr>
		  </table>
		  </font></td>
		  <td width="26%">
		  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber15">
			<tr>
			  <td width="100%"><font face="Arial Narrow" size="2" color="#696969">
			   Nome da mãe:</font></td>
			</tr>
			<tr>
			  <td width="100%"><font face="verdana" color="#422a09" size="-2">
				   <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="100" size="33" name="nome_mae" value="<%=session("nome_mae")%>"></font></td>
			</tr>
		  </table>
		  </td>
		  <td width="25%">
		  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber16">
			<tr>
			  <td width="100%"><font face="Arial Narrow" size="2" color="#696969">
			   Telefone fixo:</font></td>
			</tr>
			<tr>
			  <td width="100%"><font face="verdana" color="#422a09" size="-2">
				   <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="100" size="20" name="telefone_fixo" value="<%=session("telefone_fixo")%>"></font></td>
			</tr>
		  </table>
		  </td>
		</tr>
	  </table>
	  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber3" height="1">
		<tr>
		  <td width="100%" height="16" colspan="2">
		  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber17">
			<tr>
			  <td width="22%">
			  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="77%" id="AutoNumber18">
				<tr>
				  <td width="100%"><font face="Arial Narrow" size="2" color="#696969">
				  Telefone celular:</font></td>
				</tr>
				<tr>
				  <td width="100%"><font face="verdana" color="#422a09" size="-2">
				  <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="100" size="23" name="telefone_celular" value="<%=session("telefone_celular")%>"></font></td>
				</tr>
			  </table>
			  </td>
			  <td width="1%">
			   </td>
			  <td width="77%">
			   </td>
			</tr>
		  </table>
		  </td>
		</tr>
		<tr>
		  <td width="100%" height="1" colspan="2">
		  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber21" height="38">
			<tr>
			  <td width="100%" bgcolor="#F2F8FD" height="22">
			  <font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#422A09">
			  Endereço:</font></td>
			</tr>
			<tr>
			  <td width="100%" height="19">
			  <font face="Arial Narrow" color="#696969" size="2">
			  <table id="AutoNumber17" style="BORDER-COLLAPSE: collapse" borderColor="#ffffff" cellSpacing="0" cellPadding="0" width="99%" border="0">
				<tr>
				  <td width="42%">
				  <table id="AutoNumber19" style="BORDER-COLLAPSE: collapse" borderColor="#FFFFFF" cellSpacing="0" cellPadding="0" width="100%" border="1">
					<tr>
					  <td width="50%">
					  <font face="Arial Narrow" color="#696969" size="2">Rua:</font></td>
					  <td width="50%">
					  <font face="Arial Narrow" color="#696969" size="2">Bairro:</font></td>
					</tr>
					<tr>
					  <td width="50%">
					  <font face="verdana" color="#422a09" size="-2">
					  <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" size="46" name="rua" value="<%=session("rua")%>"></font></td>
					  <td width="50%">
					  <font face="verdana" color="#422a09" size="-2">
					  <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" size="42" name="bairro" value="<%=session("bairro")%>"></font></td>
					</tr>
				  </table>
				  </td>
				  <td width="36%">
				  <table id="AutoNumber20" style="BORDER-COLLAPSE: collapse" borderColor="#FFFFFF" cellSpacing="0" cellPadding="0" width="100%" border="1" height="33">
					<tr>
					  <td width="21%" height="16">
					  <font face="Arial Narrow" color="#696969" size="2">Número:</font></td>
					  <td width="79%" height="16">
					  <font face="Arial Narrow" color="#696969" size="2">CEP:</font></td>
					</tr>
					<script>
function MM_formtCep(e,src,mask) {
	if(window.event) { _TXT = e.keyCode; } 
	else if(e.which) { _TXT = e.which; }
	if(_TXT > 47 && _TXT < 58) { 
  var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
  if (texto.substring(0,1) != saida) { src.value += texto.substring(0,1); } 
	 return true; } else { if (_TXT != 8) { return false; } 
  else { return true; }
	}
}

					</script>
					<tr>
					  <td width="21%" height="16">
					  <font face="verdana" color="#422a09" size="-2">
					  <input class="formcolor" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" size="7" name="numero" value="<%=session("numero")%>"></font></td>
					  <td width="79%" height="16">
					  <input onkeypress="return MM_formtCep(event,this,'#####-###');" id="cep" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" maxLength="9" size="11" name="cep" value="<%=session("cep")%>"></font><font color="#FF0000" size="1" face="Verdana">(Só 
					  números)</td>
					</tr>
				  </table>
				  </td>
				</tr>
			  </table>
			  </font><font color="#696969" size="2" face="Verdana">
			  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber23">
				<tr>
				  <td width="100%" bgcolor="#F2F8FD" height="22">
				  <font color="#422A09">
				  <span style="font-weight: 700; font-size: 9pt">Informações:</span></font></td>
				</tr>
				</font><font face="Arial Narrow" color="#696969" size="2">
				<tr>
				  <td width="100%">
		  <font face="Arial Narrow" size="2" color="#696969">Está usando algum 
		  medicamento?</font></td>
				</tr>
			  </table>
			  </font></td>
			</tr>
		  </table>
		  </td>
		</tr>
				  <script type="text/javascript">
function medicamentosfuncao(medicamento) {
if(medicamento=="Sim") {
document.form.medicamentosres.style.display="block";

}
if(medicamento=="Não") {
document.form.medicamentosres.style.display="none";

}
}
		</script>
		<tr>
		  <td width="48%" height="1" valign="top">
		
		  <input type="radio" value="Sim" name="medicamento" onclick="medicamentosfuncao('Sim')" 
			<% if testesim = "Sim" then%>
		  checked

		   <%end if%>
		   
			

		  ><font face="Arial Narrow" size="2" color="#696969">Sim 
		  </font>

		  <input type="radio" value="Não" name="medicamento" onclick="medicamentosfuncao('Não')"
		  
			<% if testesim = "Não" then%>
		  checked

		   <%end if%>
		  
		  ><font face="Arial Narrow" color="#696969" size="2">Não</font></td>

		  <td width="52%" height="1" valign="bottom">
		  </td>
		</tr>
			 
		<tr>
		  <td width="48%" height="1" valign="top">
		  <font face="verdana" color="#422a09" size="-2">
		 <% if session("medicamentosres") = "" then%>
				  <input class="formcolor" onFocus="this.value=''" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana; display:none;" maxLength="100" size="33" name="medicamentosres" value="Qual(is) medicamento(s)?">
				  <%else%>
				  
							<input class="formcolor" onFocus="this.value=''" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana; display:none;" maxLength="100" size="33" name="medicamentosres" value="<%=session("medicamentosres")%>">
				  <%end if%>
				  </font></td>


		  <td width="52%" height="1" valign="bottom">
		  </td>
		</tr>
	  </table>
	  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber4">
		<tr>
		  <td width="100%"><font face="Arial Narrow" size="2" color="#696969">
		  Você tem absoluta certeza dos exames que foram solicitados?</font><font face="Arial Narrow" size="2" color="#1B57A0"> 
		  (na dúvida não responda)</font></td>
		</tr>
		<script type="text/javascript">
function examess(exames_solicitados) {
if(exames_solicitados=="Sim") {
document.form.examesinfo.style.display="block";

}
if(exames_solicitados=="Não") {
document.form.examesinfo.style.display="none";

}
}
		</script>
		<tr>
		  <td width="100%">
		 

		  <input type="radio" value="Sim" name="exames_solicitados" onclick="examess('Sim')"
		  
		  
			<% if session("exames_solicitados") = "Sim" then%>
		  checked
	 
		   <%end if%>
		  
		  >
		  
		   <% if session("exames_solicitados") = "Sim" then%>
	
	  
				<script type="text/javascript">
		   
 window.onload=function examess1() {

document.form.examesinfo.style.display="block";



}


		   
		  </script>
		   <%end if%>

		  <font face="Arial Narrow" size="2" color="#696969">Sim 
		  </font>
		  <input type="radio" value="Não" name="exames_solicitados" onclick="examess('Não')"
		  
				 <% if session("exames_solicitados") = "Não" then%>
		  checked

		   <%end if%>
		  
		  ><font face="Arial Narrow" color="#696969" size="2">Não</font></td>
		</tr>
		<tr>
		  <td width="100%"><font face="Verdana" size="1"><font face="verdana" color="#422a09" size="-2">
		  <%if session("examesinfo") = "" or session("exames_solicitados") = "Não" then %>
				  <textarea class="formcolor"  onFocus="this.value=''" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana; display:none;" name="examesinfo" rows="7" cols="79">Informe os exames digitando aqui.</textarea>
				  
				  <%else%>
				  
				  <textarea class="formcolor"  onFocus="this.value=''" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana; display:none;" name="examesinfo" rows="7" cols="79"><%=session("examesinfo")%></textarea>
<%end if%>				  
				  </font></td>



		</tr>
	  </table>
	  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber24">
		<tr>
		  <td width="100%" bgcolor="#F2F8FD" height="22">
		  <span style="font-weight: 700">
		  <font face="Verdana" style="font-size: 9pt" color="#422A09">
		  Agendamento: </font></span>
		  
		  <%if session("data_agenda") <> "" then%>
		  <font color="#FF0000" size="1" face="Verdana">(Escolha 
		  a data e a hora novamente)</font>
		  <%end if%>
		  
		  </td>
		</tr>
		<tr>
		<script language="JavaScript" type="text/javascript">
   function mascaraData(campoData){
			  var data = campoData.value;
			  if (data.length == 2){
				  data = data + '/';
				  document.forms[0].data_agenda.value = data;
	  return true;			  
			  }
			  if (data.length == 5){
				  data = data + '/';
				  document.forms[0].data_agenda.value = data;
				  return true;
			  }
		 }
		</script>
		
		  <td width="100%"><font face="Arial Narrow" size="2" color="#696969">
		  Data:</font><font face="verdana" size="-2" color="#422A09"> 
  <input type="text" name="data_agenda"  id="sel3" onBlur="RetornoAjax(this.value, 'loginteste.asp', 'teste')"  OnKeyUp="mascaraData(this);" size="12" style="BORDER-RIGHT: #7b7a64 1px solid; BORDER-TOP: #7b7a64 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #7b7a64 1px solid; BORDER-BOTTOM: #7b7a64 1px solid; FONT-FAMILY: Verdana" size="46"
><input type="reset" value="Escolha a data"
onclick="return showCalendar('sel3', '%d/%m/%Y');" style="border:1px solid #FFFFFF; FONT-SIZE: 10px; COLOR: #FFFFFF; FONT-FAMILY: Verdana; BACKGROUND-COLOR: #1B57A0" type="submit" value="Cadastrar Agendamento" border="0" name="B1" height="19" width="59"> </font><font face="Arial Narrow" size="2" color="#696969">Hora:
					  <select  style="FONT-SIZE: 10px; COLOR: #585858; FONT-FAMILY: Verdana" size="1" name="hora_agenda">
					  <option selected>- Escolha a hora -</option>
					  <%	IF rshora.EOF then %>

					 <option>Não há hora para hoje</option>
<%  else
											  rshora.MoveFirst 
											  

											if not rshora.eof then
												do while not rshora.eof 
										%>
					 <option value="<%=rshora("hora")%>"><%=rshora("hora")%></option>
					<% 		rshora.MoveNext
										   		loop
										   		
										   		 end if
										   		 										   		 end if
									%>
				 
					  </select>   <div name="teste" id="teste"></div></font></td>
		</tr>
		<tr>

		  <td width="100%"> </td>
		</tr>
	  </table>
	  <p><font color="#7b7a64" size="1" face="Arial Narrow">
			  <input class="form" style="border:1px solid #FFFFFF; FONT-SIZE: 10px; COLOR: #FFFFFF; FONT-FAMILY: Verdana; BACKGROUND-COLOR: #1B57A0" type="submit" value="Cadastrar Agendamento" border="0" name="B1" height="19" width="59">
			  <input class="form" style="border:1px solid #FFFFFF; FONT-SIZE: 10px; COLOR: #FFFFFF; FONT-FAMILY: Verdana; BACKGROUND-COLOR: #1B57A0" type="reset" value="Limpar" border="0" name="B2" height="19" width="59"></font></p>
	</form>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Agora funciona no FireFox sim, tirando aquele codigo: event.returnValue

 

O que acontece agora é quando eu chamo essa função ao selecionar um botão no preenchimento do formulário, o submite fica morto, sem ação... Se eu não seleciono, não marco o Sim, o submite vai normal, mas se seleciono, marcando o sim, o submite não vai, por que?

 

<script type="text/javascript">
function medicamentosfuncao(medicamento) {
if(medicamento=="Sim") {
document.form.medicamentosres.style.display="block";

}
if(medicamento=="Não") {
document.form.medicamentosres.style.display="none";

}
}
		</script>
		<tr>
		  <td width="48%" height="1" valign="top">
		
		  <input type="radio" value="Sim" name="medicamento" onclick="medicamentosfuncao('Sim')"

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.