Foros del Web » Programando para Internet » Javascript »

Hola! Alguien me puede ayudar!

Estas en el tema de Hola! Alguien me puede ayudar! en el foro de Javascript en Foros del Web. Hola! Mi problema es el siguiente quiero utilizar este codigo para crear un test para mi pagina web, pero al dar enter al boton no ...
  #1 (permalink)  
Antiguo 09/02/2011, 22:09
 
Fecha de Ingreso: febrero-2011
Mensajes: 1
Antigüedad: 13 años, 2 meses
Puntos: 0
Hola! Alguien me puede ayudar!

Hola!

Mi problema es el siguiente quiero utilizar este codigo para crear un test para mi pagina web, pero al dar enter al boton no sucede nada. No soy buena aun con eso, y se me dificulta,

Que me falta poner para que al dar enter me salga el resultado en otra pagina?

GRACIAS


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> RAA test Chico</title>
<script language="JavaScript">
<!--
function process()
{
var tuchicogasparastrologo = 0;
var tuchicorickyregatte = 0;
var tuchicorogerhighway= 0;
var tuchicophilipo = 0;

var f = document.f;
var i = 0;

for (i = 0; i < f.one.length; i++) if (f.a[i].checked) value = f.a[i].value;
if (value == "1") { tuchicogasparastrologo++; }
if (value == "2") { tuchicorickyregatte<++; }
if (value == "3") { tuchicorogerhighway++; }
if (value == "4") { tuchicophilipo++; }
for (i = 0; i < f.two.length; i++) if (f.b[i].checked) value = f.b[i].value;
if (value == "1") { tuchicogasparastrologo++; }
if (value == "2") { tuchicorickyregatte++; }
if (value == "3") { tuchicorogerhighway++; }
if (value == "4") { tuchicophilipo++; }
for (i = 0; i < f.three.length; i++) if (f.a[i].checked) value = f.a[i].value;
if (value == "1") { tuchicogasparastrologo++; }
if (value == "2") { tuchicorickyregatte++; }
if (value == "3") { tuchicorogerhighway++; }
if (value == "4") { tuchicophilipo++; }
for (i = 0; i < f.four.length; i++) if (f.b[i].checked) value = f.b[i].value;
if (value == "1") { tuchicogasparastrologo++; }
if (value == "2") { tuchicorickyregatte++; }
if (value == "3") { tuchicorogerhighway++; }
if (value == "4") { tuchicophilipo++; }
var out = "tuchicogasparastrologo";
i = tuchicogasparastrologo;
if (tuchicorickyregatte > i) { out="http://rogeradictas.net/tuchicorickyregatte/"; i = tuchicorickyregatte; }
if (tuchicorogerhighway > i) { out="http://rogeradictas.net/tuchicorogerhighway/"; i = tuchicorogerhighway; }
if (tuchicophilipo > i) { out="http://rogeradictas.net/tuchituchicophilipo/"; i = tuchicophilipo; }
location.href = out + "/";
}
function err(msg, url, line)
{
location.href = "error.html";
}
//window.onerror = err;
// -->
</script>
</head>
<body>
My Quiz
<form method="post"><b>1)How many feet have you
licked?<br>
<input name="one" value="1" type="radio">
Being exposed to human beings.<br>
<input name="one" value="2" type="radio">
Being the only vampire out there.<br>
<input name="one" value="3" type="radio">
Living a boring life despite all the habilities and immortality.<br>
<input name="one" value="4" type="radio">
Being told what to do. Vampires are all about freedom! We're th
exception!<br>
<br>
<b>2)How many anthills have you blowtorched?<br>
<input name="two" value="1" type="radio">
Being exposed to human beings.<br>
<input name="two" value="2" type="radio">
Being the only vampire out there.<br>
<input name="two" value="3" type="radio">
Living a boring life despite all the habilities and immortality.<br>
<input name="two" value="4" type="radio">
Being told what to do. Vampires are all about freedom! We're th
exception!<br>
<b>3)How many licked?<br>
<input name="three" value="1" type="radio">
Being exposed to human beings.<br>
<input name="three" value="2" type="radio">
Being the only vampire out there.<br>
<input name="three" value="3" type="radio">
Living a boring life despite all the habilities and immortality.<br>
<input name="three" value="4" type="radio">
Being told what to do. Vampires are all about freedom! We're th
exception!<br>
<br>
<b>4)How torched?<br>
<input name="four" value="1" type="radio">
Being exposed to human beings.<br>
<input name="four" value="2" type="radio">
Being the only vampire out there.<br>
<input name="four" value="3" type="radio">
Living a boring life despite all the habilities and immortality.<br>
<input name="four" value="4" type="radio">
Being told what to do. Vampires are all about freedom! We're th
exception!<br>
<br>
<input value="quien sera tu chico"onclick="computeForm(this.form)" type="button"><br>
<br>
</b>
</b></b></b></form>
</body>
</html>
  #2 (permalink)  
Antiguo 13/02/2011, 09:46
Avatar de IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Hola! Alguien me puede ayudar!

has de usar el objeto event para saber que tecla se ha pulsado (enter = 13). una vez que la validación devuelva true, envías el formulario. este código es meramente orientativo.

Etiquetas: hola
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 22:14.