
Uncaught TypeError: Cannot read property "0" of undefined
Publicado por david (2 intervenciones) el 21/04/2015 01:11:15
soy nuevo con js y no se que significa ese error sale en la consola de google mi código es el siguiente
Uncaught TypeError: Cannot read property '0' of undefined
mi código es el siguiente genero los checks dinamicamente y quería validar con js dinamicamente si alguien me pudiera ayudar o aconsejar se los agradeceria mucho
Uncaught TypeError: Cannot read property '0' of undefined
mi código es el siguiente genero los checks dinamicamente y quería validar con js dinamicamente si alguien me pudiera ayudar o aconsejar se los agradeceria mucho
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!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>
<%
int intNumControles = 5;
%>
<script type="text/javascript" language="javascript">
function IrAUrl(NumControles)
{ // funcion IrAUrl(TOP)
var controlesSeleccionados = 0;
for (var i = 0; i<NumControles; i++)
{ // ciclo para validar el numero de controles (TOP)
//alert("letra" + i);
if (document.frmPrincipal.chck[i].checked==true)
{ // si algun control esta checado (TOP)
controlesSeleccionados++;
} // si algun control esta checado (BOTTOM)*/
} // ciclo para validar el numero de controles (BOTTOM)
if (controlesSeleccionados < 2)
{ // si los controles son menos de dos seleccionados (TOP)
alert("debe seleccionar almenos dos controles");
//document.frmPrincipal.chck1.focus();
return false;
} // si los controles son menos de dos seleccionados (BOTTOM)
else
{
return true;
}
} // funcion IrAUrl(BOTTOM)
</script>
</head>
<body>
<form name="frmPrincipal" action="java2.jsp" method="post" onSubmit="return IrAUrl(<%= intNumControles %>)">
<%
for(int i=0;i<intNumControles;i++)
{ //imprime el numero de controles establecido (TOP)
%>
numero <%= i %><input type="checkbox" name="chck<%= i %>" value="<%= i %>" />
<%
} //imprime el numero de controles establecido (BOTTON)
%>
<input name="btnAccion" type="submit" />
</form>
</body>
</html>
Valora esta pregunta


0