Foros del Web » Creando para Internet » HTML »

Cuestionarios Con Respuestas

Estas en el tema de Cuestionarios Con Respuestas en el foro de HTML en Foros del Web. Amigos del web del programador: Solicito ayuda urgente para realizar lo sgte: Necesito un formulario donde 1. el usuario pueda elegir entre varias elternativas 2. ...
  #1 (permalink)  
Antiguo 29/04/2002, 16:01
 
Fecha de Ingreso: febrero-2002
Mensajes: 10
Antigüedad: 22 años, 2 meses
Puntos: 0
Cuestionarios Con Respuestas

Amigos del web del programador:

Solicito ayuda urgente para realizar lo sgte:

Necesito un formulario donde
1. el usuario pueda elegir entre varias elternativas
2. Que al final le muestre la calificacion en base a las respuestas buenas que obtuvo y ademas un item donde aparesca la respuesta que el marco y la respuesta correcta

Por favor, ayudenme
  #2 (permalink)  
Antiguo 30/04/2002, 07:20
bet
 
Fecha de Ingreso: febrero-2001
Mensajes: 292
Antigüedad: 23 años, 2 meses
Puntos: 0
Re: Cuestionarios Con Respuestas

Algo así te sirve? Esto guardalo en un archivo .html
Código:
<html>
<head><title> Examen </title>
<style type="text/css">
body {
 font-family: Verdana, Arial;
 font-size: 10pt;
}
p { color:"blue";}
</style>

<script language="JavaScript" src="test.js"></script> 

</head>

<body onload="tomarValor()">

<b>Test 1 - </b>

<FORM NAME="examen" onSubmit="return averiguarNota(this);">

<p>La estructura a = b ? c : d; es...</p>
<INPUT TYPE="radio" NAME="1" VALUE="mal">un bucle<BR>
<INPUT TYPE="radio" NAME="1" VALUE="mal">una operación aritmética<BR>
<INPUT TYPE="radio" NAME="1" VALUE="bien">una condición<BR><BR>

<p>el atributo <TT>window.status</TT> contiene:<BR>
<INPUT TYPE="radio" NAME="2" VALUE="bien">el valor de la barra de estado<BR>
<INPUT TYPE="radio" NAME="2" VALUE="mal">el valor por defecto de la barra de estado<BR>
<INPUT TYPE="radio" NAME="2" VALUE="mal">ciertas características de la ventana<BR><BR>

<p>el evento <I>load</I> ocurre:<BR>
<INPUT TYPE="radio" NAME="3" VALUE="bien">cuando termina de cargarse una página<BR>
<INPUT TYPE="radio" NAME="3" VALUE="mal">cuando termina de cargarse un gráfico<BR>
<INPUT TYPE="radio" NAME="3" VALUE="mal">cuando empieza a cargarse una página<BR><BR>

<p>¿Que <I>array</I> contiene los gráficos de una página?<BR>
<INPUT TYPE="radio" NAME="4" VALUE="mal">document.graphics<BR>
<INPUT TYPE="radio" NAME="4" VALUE="bien">document.images<BR>
<INPUT TYPE="radio" NAME="4" VALUE="mal">no hay ninguno<BR><BR>

<p>el método <TT>alert</TT> sirve para:<BR>
<INPUT TYPE="radio" NAME="5" VALUE="mal">hacer sonar un pitido de alarma<BR>
<INPUT TYPE="radio" NAME="5" VALUE="bien">lanzar una ventana con información<BR>
<INPUT TYPE="radio" NAME="5" VALUE="mal">decirle al navegador que hay un problema con el código<BR><BR>

<INPUT TYPE="submit" VALUE="Quiero saber mi nota">
</FORM>
</body>
</html>
sigue...
  #3 (permalink)  
Antiguo 30/04/2002, 07:25
bet
 
Fecha de Ingreso: febrero-2001
Mensajes: 292
Antigüedad: 23 años, 2 meses
Puntos: 0
Re: Cuestionarios Con Respuestas

Esto guardalo bajo el nombre de test.js

Código:
var usu = new Array();
var id = new Array();
usu[0] = "pepe1";
usu[1] = "pepe2";
usu[2] = "pepe3";
id[0] = "pepe1";
id[1] = "pepe2";
id[2] = "pepe3";

resp = new Array();

window.moveTo(0,0);
if (document.all) {
	top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else { 
	if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}


function tomarValor(){
	url = location.href;
	val = url.indexOf("?");   //busca signo de interrogacion
	val = url.substring(val+1,url.length);
	datos = new Array();
	datos = val.split("&")	// corta por un determinado patron de separacion , tab &
	queUsu = new Array();		// toma solo el nombre del usuario
	queUsu = datos[0].split("=");
}

function averiguarNota(examen) {       
	var resultado=0;       
	var total=0;
	for (i=0;i<examen.elements.length;i++) {        
		if ((examen.elements[ i].type=="radio")&& (examen.elements[ i].checked)) {
			if (examen.elements[ i].value=="bien")  {
				resultado++;       
			}
			total++;
			switch(examen.elements[ i].name){
				case "1": resp[0]=examen.elements[ i].value; break;
				case "2": resp[1]=examen.elements[ i].value; break;
				case "3": resp[2]=examen.elements[ i].value; break;
				case "4": resp[3]=examen.elements[ i].value; break;
				case "5": resp[4]=examen.elements[ i].value; break;
			}
		}
	}
	if (total <5){
		alert("Por favor responda todas las preguntas");
		return false;
	}
	mostrarResultado();     
}
sigue...
  #4 (permalink)  
Antiguo 30/04/2002, 07:25
bet
 
Fecha de Ingreso: febrero-2001
Mensajes: 292
Antigüedad: 23 años, 2 meses
Puntos: 0
Re: Cuestionarios Con Respuestas

Código:
function mostrarResultado() {
var resp2 = new Array();
for(i=0;i<5;i++){
	resp2[ i] = (resp[ i] == "bien") ? '<img src="up.gif">' : '<img src="down.gif">';
}
newwin = window.open('','','top=150,left=150,width=325,height=300');
newwin.opener = self; 
with (newwin.document){
		open();
		write('<html>');
		write('<style type="text/css">');
		write('body {font-family: Verdana, Arial;font-size: 10pt;}');
		write('</style>');
		write('<body>');
		write('<p><b>Respuestas de ' + queUsu[1] + '</b> </p>');
		write('<p>Respuesta 1: ' + resp2[0] + '</p>');
		write('<p>Respuesta 2: ' + resp2[1] + '</p>');
		write('<p>Respuesta 3: ' + resp2[2] + '</p>');
		write('<p>Respuesta 4: ' + resp2[3] + '</p>');
		write('<p>Respuesta 5: ' + resp2[4] + '</p>');
		write('</center></body></html>');
		close();
   }
}
Terminó!

<hr noshade size=1><img src="http://www.gograph.com/Images-8712/ClipArt/cat03.gif" height="50" border=0 align="absmiddle"> <font size="2" face="verdana" color="#000000">bet[/CODE]
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:53.