Foros del Web » Programando para Internet » Javascript »

porque no funciona el script

Estas en el tema de porque no funciona el script en el foro de Javascript en Foros del Web. alguie sabe a que se debe que el script de function validar no responde..pero eso solo sucede cuando inserto el function list, donde esa funcion ...
  #1 (permalink)  
Antiguo 29/09/2003, 11:51
Avatar de vlah  
Fecha de Ingreso: enero-2002
Mensajes: 254
Antigüedad: 22 años, 3 meses
Puntos: 0
porque no funciona el script

alguie sabe a que se debe que el script de function validar no responde..pero eso solo sucede cuando inserto el function list, donde esa funcion lo unico que hace son dos combos anidados..y no entiendo el porque si son dos funciones diferentes no responde una ...no se si por que la manera en que las mando a llamar...

alguien debido a que

<SCRIPT>
function validar(formulario) {
if (formulario.idalumno.value.length < 4) {
alert("Escriba por lo menos 4 caracteres en el campo \"ID ALUMNO\".");
formulario.idalumno.focus();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú "+"1234567890";
var checkStr = formulario.idalumno.value;
var allValid = true;
for (i = 0; i < checkStr.length; i++) {
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length) {
allValid = false;
break;
}
}
if (!allValid) {
alert("Escriba sólo letras Y Numeros en el campo \"ID ALUMNO\".");
formulario.idalumno.focus();
return (false);
}

if (formulario.clave.value.length < 4) {
alert("Escriba por lo menos 4 caracteres en el campo \"CONTRASEÑA\".");
formulario.clave.focus();
return (false);
}
if (formulario.clave2.value.length < 4) {
alert("Escriba por lo menos 4 caracteres en el 2do Campo \"CONTRASEÑA \".");
formulario.clave2.focus();
return (false);
}
if (formulario.clave.value != formulario.clave2.value) {
alert ("Las contraseñas proporcionadas no son iguales")
formulario.clave.focus();
return(false);
}
if (formulario.nombre.value.length < 4) {
alert("Escriba por lo menos 4 caracteres en el campo \"NOMBRE\".");
formulario.nombre.focus();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú ";
var checkStr = formulario.nombre.value;
var allValid = true;
for (i = 0; i < checkStr.length; i++) {
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length) {
allValid = false;
break;
}
}
if (!allValid) {
alert("Escriba sólo letras en el campo \"NOMBRE\".");
formulario.nombre.focus();
return (false);
}
if (formulario.apellidos.value.length < 4) {
alert("Escriba por lo menos 4 caracteres en el campo \"APELLIDOS\".");
formulario.nombre.focus();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú ";
var checkStr = formulario.apellidos.value;
var allValid = true;
for (i = 0; i < checkStr.length; i++) {
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length) {
allValid = false;
break;
}
}
if (!allValid) {
alert("Escriba sólo letras en el campo \"APELLIDOS\".");
formulario.apellidos.focus();
return (false);
}
if (formulario.IdCarrera.value.length < 4) {
alert("Seleccione la carrera correspondiente.");
formulario.IdCarrera.focus();
return (false);
}
if ((formulario.email.value.indexOf ('@', 0) == -1)||(formulario.email.value.length < 5)) {
alert("Escriba una dirección de correo válida en el campo \"Email\".");
formulario.email.focus();
return (false);
}
if (formulario.SubCatagory.value.length < 4) {
alert("Escriba el grupo correspondiente");
formulario.SubCatagory.focus();
return (false);
}
if (formulario.opcion.value.length < 2) {
alert("Seleccione la Opcion de Estudios");
formulario.opcion.focus();
return (false);
}

return (true);
}

// FUNCION DE COMBO BOX COMBINADO

function sublist(inform, selecteditem)
{
inform.subcatagory.length = 0

<%
count= 0
y=0
do while not atabla9.eof
%>

x = <%= trim(y) %>;

subcat = new Array();
subcatagorys = "<%=(Atabla9("Clave_Grupo"))&" "&(Atabla9("Id_Carrera")) %>";
subcatagoryof = "<%=(Atabla9("Id_Carrera"))%>";
subcatagoryid = "<%=(Atabla9("Clave_Grupo"))%>";
subcat[x,0] = subcatagorys;
subcat[x,1] = subcatagoryof;
subcat[x,2] = subcatagoryid;
if (subcat[x,1] == selecteditem) {
var option<%= trim(count) %> = new Option(subcat[x,0], subcat[x,2]);
inform.subcatagory.options[inform.subcatagory.length]=option<%= trim(count)%>;
}
<%
count = count + 1
y = y + 1
Atabla9.movenext
loop
Atabla9.close
%>
}
</SCRIPT>
</head>





<form name="formulario" method="post" onSubmit = "return validar(this)" action="altaAlum.asp?func=1">
<table width="300" border="1" cellspacing="1" cellpadding="3" bordercolor="#333366" bgcolor="#E8ECFF">
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">ID ALUMNO</td>
<td colspan="2"><input type="text" name="idalumno" size="7" class="letranormalazul"></td>
</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">CONTRASEÑA </td>
<td colspan="2"><input type="password" name="clave" size="8" class="letranormalazul"></td>
</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">CONTRASEÑA </td>
<td colspan="2"><input type="password" name="clave2" size="8" class="letranormalazul"></td>
</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">NOMBRE</td>
<td colspan="2"><input type="text" name="nombre" size="30" class="letranormalazul"></td>
</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">APELLIDOS</td>
<td colspan="2"><input type="text" name="apellidos" size="50" class="letranormalazul"></td>

</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">CARRERA</td>
<td colspan="2">

<select id="IdCarrera" name="IdCarrera" class="letranormalazul" onchange="javascript:sublist(this.form,IdCarrera.v alue)">
<option selected>Seleccione...</option>
<%while not Atabla5.eof%>
<option value =<%=Atabla5("IdCarrera")%>>
<%=Atabla5("NomCarrera")%>
<%Atabla5.movenext
wend%>
</select></td>
</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">GRUPO</td>
<td colspan="2"><SELECT id="subcatagory" name="subcatagory" size="1" class="letranormalazul"><option selected value="none"></option></SELECT></td>
</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">EMAIL</td>
<td colspan="2"><input type="text" name="email" class="letranormalazul"></td>
</tr>
<tr>
<td colspan="2" class="letranormalblanca" bgcolor="#333366">OPCION</td>
<td colspan="2">
<Select name="Opcion" class="letranormalazul">
<option selected>Seleccione...</option>
<%while not Atabla6.eof%>
<option value=<%=Atabla6("Clave_Opcion")%>>
<%=Atabla6("Tipo_Opcion")%></option >
<%Atabla6.movenext
wend%>
</select></td>
</tr>


salu2 y gracias!
__________________
<<<<VLAH>>>>> :-D
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 01:35.