Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/10/2012, 11:46
KAKOROSAS
 
Fecha de Ingreso: enero-2004
Mensajes: 72
Antigüedad: 20 años, 4 meses
Puntos: 1
cuenta regresiva con submit automatico

Hola .. el usuario Dradi7

me soluciooe un problema que tenia con un script por lo cual tengo este codigo de ejemplo

Código 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
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<
title>Documento sin título</title
* * <
script>
* * * * function 
validar(){
* * * * * * return 
false; * * * *
* * * * }
* * 
</script>
</head> 
*
<body> 
<form id="form2" name="form2" method="post" action="" onsubmit="return validar();"> 
* * pregunta 1
* <p> 
* * <label> 
* * * <input type="radio" name="a1" value="a" id="a1_0" /> 
* * * a</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a1" value="b" id="a1_1" /> 
* * * b</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a1" value="c" id="a1_2" /> 
* * * c</label> 
* * <br /> 
* </p>
* * <br/>
* * pregunta 2
* <p> 
* * <label> 
* * * <input type="radio" name="a2" value="a" id="a2_0" /> 
* * * a</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a2" value="b" id="a2_1" /> 
* * * b</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a2" value="c" id="a2_2" /> 
* * * c</label> 
* </p> 
* * <br/>
* * pregunta 3
* <p> 
* * <label> 
* * * <input type="radio" name="a3" value="a" id="a2_3" /> 
* * * a</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a3" value="b" id="a2_4" /> 
* * * b</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a3" value="c" id="a2_5" /> 
* * * c</label> 
</p> 
* * <br/>
* * pregunta 4
* <p> 
* * <label> 
* * * <input type="radio" name="a4" value="a" id="a2_6" /> 
* * * a</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a4" value="b" id="a2_7" /> 
* * * b</label> 
* * <br /> 
* * <label> 
* * * <input type="radio" name="a4" value="c" id="a2_8" /> 
* * * c</label> 
* </p> 
* <p><br /> 
* </p> 
* <p> * *<input type="submit" name="enviar" id="enviar" value="Enviar" /><br /> 
</p> 
</form> 
</body> 
</html> *​ 
Código PHP:
function comprobarPregunta(ele){
* * var 
radios document.getElementsByName(ele);
* * var 
noContesto true;
* * for(var 
x=0;radios[x];x++){
* * * * if(
radios[x].checked){
* * * * * * 
noContesto false;
* * * * * * break;
* * * * }
* * }
* * return 
noContesto;
}
function 
validar(){
* * var 
ele document.forms['form2'].elements;
* * var 
name '';
* * var 
noContestados '';
* * for(var 
x=0;ele[x];x++){
* * * * if(
ele[x].type == "radio" && ele[x].name!=name){
* * * * * * 
name ele[x].name;
* * * * * * 
noContestados += comprobarPregunta(ele[x].name) ? (name.replace(/D/gi,"") + ', ') : '';
* * * * }else{
* * * * * * continue;
* * * * }
* * }
*
* * if(
noContestados!=''){
* * * * 
// CON ESTO ESTOY VERIFICANDO QUE SI PONE EN ACEPTAR ENTONCES REALIZAR EL SUBMIT DE LO CONTRARIO QUE NO HAGA EL SUBMIT
* * * * if(confirm("Falta responer las siguientes preguntas " noContestados.substr(0,noContestados.length-2))){
* * * * * * return 
true;
* * * * }else{
* * * * * * return 
false;
* * * * }
* * }
* * return 
true;

la idea es ahora colocar un reloj lo mas simple posible .. con 2 horas para responder "cuenta regresiva" y cuando queden 5 min avise nomas .. y al terminar que envie si o si las respuestas

muchas gracias por la ayuda

Última edición por KAKOROSAS; 12/10/2012 a las 12:35