Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/06/2013, 10:42
marlonphp
 
Fecha de Ingreso: junio-2013
Mensajes: 11
Antigüedad: 10 años, 10 meses
Puntos: 0
imprimir resultado de un cuestionario.

Hola, espero que me puedan ayudar.

tengo una pagina en php llamado index.php, el cual tiene preguntas y respuestas con input (radio).
la pagina esta bien cumple con el objetivo que necesito que haga pero quiero modificarlo. lo que pasa es que me imprime los cantidad de correctas e incorrectas. pero lo hace en una alerta. lo qque necesito es que se imprima en una pagina comun, ya sea html o php. le adjunto el codigo.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Documento sin t&iacute;tulo</title>

<script type="text/javascript">


function RevisarCuestionario(){
var correcta=0;
var incorrecta=0;

if (document.forms[0].resp1[2].checked==true){
correcta=correcta+1;
}
else{
incorrecta = incorrecta + 1;
}
if (document.forms[0].resp2[0].checked==true){
correcta=correcta+1;
}
else{
incorrecta = incorrecta + 1;
}
if (document.forms[0].resp3[2].checked==true){
correcta=correcta+1;
}
else{
incorrecta = incorrecta + 1;
}
if (document.forms[0].resp4[1].checked==true){
correcta=correcta+1;
}
else{
incorrecta = incorrecta + 1;
}
if (document.forms[0].resp5[1].checked==true){
correcta=correcta+1;
}
else{
incorrecta = incorrecta + 1;
}
if (document.forms[0].resp6[1].checked==true){
correcta=correcta+1;
}
else{
incorrecta = incorrecta + 1;
}


alert('Respuestas correctas: '+correcta+'\nRespuestas incorrectas: '+incorrecta);
}
</script>
</head>

<body align="center">
<form name="radios">
SELECCIONA LA ALTERNATIVA CORRECTA:<br /><br />

1- PREGUNTA 1:<br>
a)&nbsp;<input type="radio" name="resp1" value="r1" />respuesta1<br>
b)&nbsp;<input type="radio" name="resp1" value="r1" />respuesta2<br>
c)&nbsp;<input type="radio" name="resp1" value="v" />CORRECTO<br>
d)&nbsp;<input type="radio" name="resp1" value="r1" />respuesta4<br /><br />

2- PREGUNTA 2:<br>
a)&nbsp;<input type="radio" name="resp2" value="v" />CORRECTO<br>
b)&nbsp;<input type="radio" name="resp2" value="r2" />respuesta2<br>
c)&nbsp;<input type="radio" name="resp2" value="r2" />respuesta3<br>
d)&nbsp;<input type="radio" name="resp2" value="r2" />respuesta4<br /><br />

3- PREGUNTA 3:<br>
a)&nbsp;<input type="radio" name="resp3" value="r3" />respuesta1<br>
b)&nbsp;<input type="radio" name="resp3" value="r3" />respuesta2<br>
c)&nbsp;<input type="radio" name="resp3" value="v" />CORRECTO<br>
d)&nbsp;<input type="radio" name="resp3" value="r3" />respuesta4<br /><br />

4- PREGUNTA 4:<br>
a)&nbsp;<input type="radio" name="resp4" value="r4" />respuesta1<br>
b)&nbsp;<input type="radio" name="resp4" value="v" />CORRECTO<br>
c)&nbsp;<input type="radio" name="resp4" value="r4" />respuesta3<br>
d)&nbsp;<input type="radio" name="resp4" value="r4" />respuesta4<br /><br />

5- PREGUNTA 5:<br>
a)&nbsp;<input type="radio" name="resp5" value="r5" />respuesta1<br>
b)&nbsp;<input type="radio" name="resp5" value="v" />CORRECTO<br>
c)&nbsp;<input type="radio" name="resp5" value="r5" />respuesta3<br>
d)&nbsp;<input type="radio" name="resp5" value="r5" />respuesta4<br /><br />

6- PREGUNTA 6:<br>
a)&nbsp;<input type="radio" name="resp6" value="r6" />respuesta1<br>
b)&nbsp;<input type="radio" name="resp6" value="v" />CORRECTO<br>
c)&nbsp;<input type="radio" name="resp6" value="r6" />respuesta3<br>
d)&nbsp;<input type="radio" name="resp6" value="r6" />respuesta4<br /><br />

<input type="button" onclick="RevisarCuestionario();" value="ver Resultados">
</form>
</body>
</html>