Ir para conteúdo

POWERED BY:

Arquivado

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

Biel.

Fazer os três se enxergar. botao1, script php e script javascript

Recommended Posts

Bom dia a todos. Pessoal como inserir o botao1 no script javaScript para que funcione na hora que o script executar ação.
OBS: Se eu clicar no botao1 sem SCRIPT JAVASCRIPT o email é enviado normalmente para joao@gmail.com
Eu quero que o botao1 continue funcionando, mas dessa vez integrado no SCRIPT JAVASCRIPT
IMP: observe no form que botao1 está vinculado ao script PHP que funciona normalmente. Pessoal eu quero que os três se enxerguem botao1, script php, script javascript. É isso gente!
esta é a página contato.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Documento sem título</title>

<script type="text/javascript">
window.onload = function(){
 
var contagem = document.getElementById("contagem");
var enviar = document.getElementById("startSending");
var parar = document.getElementById("stopSending");
var continuar = document.getElementById("continueSending");
 
var qtd = 0;
var qtd2 = 1;
var limit = 5;
var seconds = 5;
 
function submeter(){
  if( qtd < limit ){
    document.forms.tetete.submit();
    qtd++;
contagem.innerHTML = "Quantidade: "+qtd2++;
  }
 
}
function start_sending(){
    seconds *= 500;
    window.setInterval(function(){submeter()},seconds);
}
function stop_timer(){
     limit = qtd;
}
  
enviar.onclick = function(){
start_sending();
}
 
parar.onclick = function(){
stop_timer();
}
 
continuar.onclick = function(){
limit = 6;
start_sending();
}
  
}
</script>

</head>

<body>
<span id="contagem"></span>
<iframe src="about:blank" width="100" height="200" name="ifrm"></iframe>
<br />
<br />

<form action="formulario.php" method="post" name="tetete" target="ifrm">
 
<input type="submit" name="" value="ENVIAR" id="startSending" />
<input type="button" name="" value="interromper" id="stopSending" />
<input type="button" name="" value="Continuar" id="continueSending" />

<br />
<br />

<input type="submit" name="naomecher" id="a" value="botao1"/>

</form>

</body>
</html>

 

esta é a página formulario.php

<?php

if($naomecher=="botao1"){$destinatario="joao@gmail.com ";}

mail($destinatario,$assunto,$mensagem,$headers);
		
?>

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom, eu uso o seguinte, crio um pseudo botão de submeter que assim que o usuário clicar nele a função Javascript é ativada, e no final da função Javascript o código clica no botão real que vai estar escondido, assim enviando o formulário. Pra fazer algo assim utilize este código:

 

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Documento sem título</title>




<script type="text/javascript">
window.onload = function(){




var contagem = document.getElementById("contagem");
var enviar = document.getElementById("startSending");
var parar = document.getElementById("stopSending");
var continuar = document.getElementById("continueSending");




var qtd = 0;
var qtd2 = 1;
var limit = 5;
var seconds = 5;




function submeter(){
  if( qtd < limit ){
    document.forms.tetete.submit();
    qtd++;
contagem.innerHTML = "Quantidade: "+qtd2++;
  }


function clicar_no_botao_real(){
document.getElementById("real-botao").click();
}


}
function start_sending(){
    seconds *= 500;
    window.setInterval(function(){submeter()},seconds);
    window.setInterval(function(){clicar_no_botao_real()},seconds);


}
function stop_timer(){
     limit = qtd;
}
  
enviar.onclick = function(){
start_sending();
}




parar.onclick = function(){
stop_timer();
}




continuar.onclick = function(){
limit = 6;
start_sending();
}
  
}
</script>




</head>




<body>
<span id="contagem"></span>
<iframe src="about:blank" width="100" height="200" name="ifrm"></iframe>
<br />
<br />




<form action="formulario.php" method="post" name="tetete" target="ifrm">




<input type="submit" name="" value="ENVIAR" style="display:none;" id="real-botao" />
<input type="button" value="ENVIAR" id="startSending" class="pseudo-botao" />
<input type="button" name="" value="interromper" id="stopSending" />
<input type="button" name="" value="Continuar" id="continueSending" />




<br />
<br />




<input type="submit" name="naomecher" id="a" value="botao1"/>




</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.