Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/07/2014, 16:43
davidparlow
 
Fecha de Ingreso: julio-2014
Mensajes: 22
Antigüedad: 9 años, 9 meses
Puntos: 0
funcion css () la cual hace aparecer un formulario dependiendo del click

Hola que tal, estoy tratando de hacer un formulario donde el usuario clickea unos checkbox dependiendo de su problema (incidente ó requerimiento), dependiendo de en cual haga click se desplegara un formulario de selects y ya dependiendo de las opciones que vaya seleccionado el siguiente select se ajustara automaticamente y asi consecutivamente...

El problema recae desde un principio, en donde el usuario clickea el checkbox, en ambos clicks aparece lo mismo, como puedo hacer para que me de el formulario distinto?

pego el codigo, porfavor espero y me puedan ayudar, saludos!



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script language="JavaScript">

function addOpt(oCntrl, iPos, sTxt, sVal){
var selOpcion=new Option(sTxt, sVal);
eval(oCntrl.options[iPos]=selOpcion);
}

function cambia(oCntrl){
switch (document.frm.incidente.selectedIndex){
case 0:
addOpt(oCntrl, 0, "Office", "#");
addOpt(oCntrl, 1, "Adobe", "#");
addOpt(oCntrl, 2, "Windows", "#");
break;
case 1:
addOpt(oCntrl, 0, "Laptop", "#");
addOpt(oCntrl, 1, "Monitor", "#");
addOpt(oCntrl, 2, "Mouse", "#");
break;
case 2:
addOpt(oCntrl, 0, "Internet", "#");

break;
}
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Condicionar secciones</title>
<script type="text/javascript" src="Funciones/js/funciones.js"></script>
<style type="text/css">
.onstate-datos { display: block; }
.offstate-datos { display: none; }
</style>

<script>
$(document).ready(function(){
$("activar").click(function(){
$("switch-datos").css("display","none");
});
});
</script>


</head>
<body>

<form action="#" method="post">
<fieldset>
<legend>Datos del usuario</legend>

<table border="1" width="80%" align="center">
<tr>
<td><input id="activar" type="checkbox" class="switch-datos"/><label for="activar">Incidente</label><br></td>
<td><input id="activar2" type="checkbox" class="switch-datos"/><label for="activar2">Requerimiento</label><br></td>
</tr>
</table>

<div class="offstate-datos">
<br>
Hubo algun cambio de pieza? <br>
<input type=radio name=choice value='yes' onClick="radio_check()";>Si
<input type=radio name=choice value='no' onClick="radio_check()";>No
<br>
<form name="frm">
<table border="0" width="482">
<tr>
<td width="25">
Incidente
</td>
<td width="89">
<select name="incidente" onchange="cambia(document.frm.requerimiento)">
<option value="Mex">Software</option>
<option value="Esp">Hardware</option>
<option value="Ven">Internet</option>
</select>
</td>


</tr>
<tr>
<td width="44">
Requerimiento
</td>
<td width="296">
<select name="requerimiento" onChange="location.href=this.form.requerimiento.op tions[this.form.requerimiento.selectedIndex].value">
<option value="0">Instalacion/desinstalacion</option>
<option value="1">Reubicacion</option>
<option value="2">Cambio</option>
</select>
</td>
</tr>
<tr>
<td>

</td>
<td><input type="button" value="Ir" onClick="location.href=this.form.ciudad.options[this.form.ciudad.selectedIndex].value"></td>
</tr>
</table>
</form>
</div>

<!-- //Este segun eso era el formulario del 2
<div class="offstate-datos2">
<br>
form 2<br>
<input type=radio name=choice value='yes' onClick="radio_check()";>Si
<input type=radio name=choice value='no' onClick="radio_check()";>No
<br>
<select name="Categoria 2" id="l2">
<option value=''>Elija una</option>
<option value="Tarjeta">-</option>
</div>
</form> //este es de abajo
!-->

<!--
<input type="submit" value="Enviar los datos"/>
<br><br>

<label for="tarjeta">-</label><input type="text" id="tarjeta"/><br>
<label for="fecha-exp">-</label><input type="text" id="fecha-exp"/>
<input onclick="data_check()"; value="Submit Form" type="button">
</fieldset>
</form>



</body>
</html>