Ver Mensaje Individual
  #8 (permalink)  
Antiguo 25/08/2008, 11:55
txiti
 
Fecha de Ingreso: junio-2008
Mensajes: 168
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Validacion si es numero

<script>
function validarSiNumero(numero,nombre){
//if (!/^([0-9])*$/.test(numero))
if ((!/^([0-9])*$/.test(numero))&&(!/^([0.0-9.9])*$/.test(numero))){
alert("El valor " + numero + " no es un número");
document.nombre.focus();
return false;
}
}
</script>
<body>
<%
//ControladorBD cbd=new ControladorBD();
%>
<%
carrera=(String)session.getAttribute("carrera");
calculo=(String)session.getAttribute("calculo");
m=(String)session.getAttribute("m");
n=(String)session.getAttribute("n");
int muestra = Integer.parseInt(m);
int clase = Integer.parseInt(n);
%>

<table width="813" border="1" align="center" bordercolor="#BBDDFF">
<tr>
<td width="247">&nbsp;</td>
<td width="550"><div align="right">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="103" height="24">
<param name="BGCOLOR" value="#BBDDFF">
<param name="movie" value="button280.swf">
<param name="quality" value="high">
<embed src="button280.swf" width="103" height="24" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#BBDDFF" ></embed>
</object>
</div></td>
</tr>
<tr>
<td><table width="173" border="6" bordercolor="#FFFFFF" bgcolor="#0000FF">
<tr>
<td width="153"><img src="Imagenes/universidad%201.JPG" width="153" height="368"></td>
</tr>
</table>
<div align="center"></div></td>
<td width="550">
<form name="form2" method="post" id="form2" action="ventanaAnalisisVarianza4.jsp">
<p>&nbsp;</p>
<%
String txt=request.getParameter("txt");
session.setAttribute("num",txt);
%>
<div align="left">
<p align="center">&nbsp;</p>
<%

if(n.compareTo("3")==0){//3 columnas
%>
<table width="454" border="4" align="center" bordercolor="#0000FF" bgcolor="#FFFFFF">
<tr>
<td width="144"><div align="center" class="Estilo3">A</div></td>
<td width="144"><div align="center" class="Estilo3">B</div></td>
<td width="144"><div align="center" class="Estilo3">D</div></td>
</tr>
<tr>
<%
int cont=1;
while(cont<=muestra){%>
<%
String valorA="a"+cont;
String valorB="b"+cont;
String valorD="d"+cont;
%>
<td ><input type="text" name="<%=valorA%>" onBlur="validarSiNumero(this.value,this.name);"></td>
<td><input type="text" name="<%=valorB%>" onBlur="validarSiNumero(this.value,this.name);"></td>
<td><input type="text" name="<%=valorD%>" onBlur="validarSiNumero(this.value,this.name);"></td>
</tr>
<%
cont++;
}%>
</table>
<%
}
else{//dos columnas solo
%>
<table width="304" border="4" align="center" bordercolor="#0000FF" bgcolor="#FFFFFF">
<tr>
<td width="144"><div align="center" class="Estilo3">A</div></td>
<td width="144"><div align="center" class="Estilo3">B</div></td>
</tr>
<tr>
<%
int cont=1;
while(cont<=muestra){%>
<%
String valorA="a"+cont;
String valorB="b"+cont;
%>
<td><input type="text" name="<%=valorA%>" onBlur="validarSiNumero(this.value,this.name);"></td>
<td><input type="text" name="<%=valorB%>" onBlur="validarSiNumero(this.value,this.name);"></td>
</tr>


<%
cont++;
}
%>
</table>
<%
}

%>

<p align="center">&nbsp;</p>
<p>&nbsp; </p>
<p>&nbsp;</p>
<p align="center">
<input name="btEnviar" type="submit" id="btEnviar" value="Enviar">
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
<div align="center"></div>

</form>
<p align="center">&nbsp;</p>
<div align="center"></div></td>
</tr>
</table>
<p align="right"><a href="analisisVarianza.jsp"><img src="Imagenes/fleaazul17.gif" width="43" height="22" border="0"></a></p>
<p>&nbsp;</p>
</body>
</html>