muchas gracias zerokilled
![Aplauso](http://static.forosdelweb.com/fdwtheme/images/smilies/aplausos.gif)
, me ayudaste mucho....
bueno dejo el codigo terminado con todas las validaciones que le hice acá
Código:
<html>
<script language="JavaScript">
function Valida(form2)
{
//ve si existe un index
for(var index=0;form2.se[index];index++)
if(form2.se[index].checked)
break;
//ve si hay algo seleccionado
if(!form2.se[index])
{
alert("seleccione alguna opcion");
return false;
}
//comienza el switch
switch(form2.se[index].value)
{
//aqui vemos si hay algo seleccionado en el list
case "1":
if(form2.stip.value == "0")
{
alert("elija alguna opcion")
return false;
break;
}
else
break
case "2":
if(form2.smarc.value == "0")
{
alert("elija alguna opcion")
return false;
break;
}
else
break
//aqui vemos si el text esta vacio
case "3":
if(form2.smodel.value.length == 0)
{
alert("escriba algo")
return false;
break;
}
else
break
//aqui vemos si dos text estan vacios(se supone que son un rango 'de' 'hasta')
case "4":
if(form2.de.value.length == 0 || form2.hasta.value.length == 0)
{
alert("debe llenar los 2 precios")
return false;
break;
}
//si uno es mayor al otro
if(form2.de.value.length > form2.hasta.value.length)
{
alert("el precio 'de' debe ser menos que 'hasta'")
return false;
break;
}
//si es numero
if(isNaN(form2.de.value) || isNaN(form2.hasta.value))
{
alert("Debe ingresar solo numeros")
return false;
break
}
else
break;
case "5":
if(form2.sdist.value == "0")
{
alert("elija alguna opcion")
return false;
break;
}
else
break
default:
alert("seleccione algoa")
return false;
break;
}
return true;
}
</script>
gracias...