- Tema Autor
- #1
Que tal bakunos.
Ps pasando por aqui con un problema.
Tengo un formulario q oculta y muestra campos dependiendo del tipo de
usuario (alumnos/empresas) q esta en un select. Todo esta bien hasta
aqui, la cuestion es q no sè como hacerle para q me oculte la fila de
la tabla(Por ejemplo:Nombre de usuario) y asi las demas filas
dependiendo del usuario. Alguien podria ayudarme o algun consejo u otra
alternativa para aparecer y ocultar el formulario dependiendo del
usuario. De antemano muchas gracias por su ayuda. Aqui les paso mi
codigo.
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
function Cambio(option)
{
if ( option.value == "Alumno" )
{
document.getElementById("Campo").style.visibility = "visible";
document.getElementById("Campo2").style.visibility = "visible";
document.getElementById("Campo3").style.visibility = "visible";
document.getElementById("Campo4").style.visibility = "visible";
}
else if ( option.value == "Empresa" )
{
document.getElementById("Campo").style.visibility = "visible";
document.getElementById("Campo2").style.visibility = "visible";
document.getElementById("Campo3").style.visibility = "hidden";
document.getElementById("Campo4").style.visibility = "hidden";
}
else
{
document.getElementById("Campo").value = "";
document.getElementById("Campo").style.visibility = "hidden";
document.getElementById("Campo2").value = "";
document.getElementById("Campo2").style.visibility = "hidden";
document.getElementById("Campo3").value = "";
document.getElementById("Campo3").style.visibility = "hidden";
document.getElementById("Campo4").value = "";
document.getElementById("Campo4").style.visibility = "hidden";
}
return
}
</script>
</head>
<body>
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle"><p>
Acceso de Alumnos y Empleados. </p>
<form method="post" action="" name="formulario"
id="formulario">
<table width="54%" border="1">
<tr>
<td width="216" rowspan="6"><div align="center"><img
src="img/unisoftlogo.jpg" width="215" height="66"></div></td>
<td>Tipo de Usuario:</td>
<td><select name="select" onChange="Cambio(this)">
<option selected>...</option>
<option value="Alumno">Alumno</option>
<option value="Empresa">Empresa</option>
</select></td>
</tr>
<tr>
<td width="155"><label>Nombre de
Usuario:</label> </td>
<td width="203"><input type="text" size="20" name="Campo"
id="Campo" style="visibility:hidden"></td>
</tr>
<tr>
<td>Contraseña:</td>
<td><input type="text" size="20" name="Campo2" id="Campo2"
style="visibility:hidden"></td>
</tr>
<tr>
<td>Matricula:</td>
<td><input type="text" size="20" name="Campo3" id="Campo3"
style="visibility:hidden"></td>
</tr>
<tr>
<td>Sistema:</td>
<td><input type="text" size="20" name="Campo4" id="Campo4"
style="visibility:hidden"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Enviar"></td>
</tr>
</table>
</form> <p> </p></td>
</tr>
</table>
</body>
</html>
Ps pasando por aqui con un problema.
Tengo un formulario q oculta y muestra campos dependiendo del tipo de
usuario (alumnos/empresas) q esta en un select. Todo esta bien hasta
aqui, la cuestion es q no sè como hacerle para q me oculte la fila de
la tabla(Por ejemplo:Nombre de usuario) y asi las demas filas
dependiendo del usuario. Alguien podria ayudarme o algun consejo u otra
alternativa para aparecer y ocultar el formulario dependiendo del
usuario. De antemano muchas gracias por su ayuda. Aqui les paso mi
codigo.
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
function Cambio(option)
{
if ( option.value == "Alumno" )
{
document.getElementById("Campo").style.visibility = "visible";
document.getElementById("Campo2").style.visibility = "visible";
document.getElementById("Campo3").style.visibility = "visible";
document.getElementById("Campo4").style.visibility = "visible";
}
else if ( option.value == "Empresa" )
{
document.getElementById("Campo").style.visibility = "visible";
document.getElementById("Campo2").style.visibility = "visible";
document.getElementById("Campo3").style.visibility = "hidden";
document.getElementById("Campo4").style.visibility = "hidden";
}
else
{
document.getElementById("Campo").value = "";
document.getElementById("Campo").style.visibility = "hidden";
document.getElementById("Campo2").value = "";
document.getElementById("Campo2").style.visibility = "hidden";
document.getElementById("Campo3").value = "";
document.getElementById("Campo3").style.visibility = "hidden";
document.getElementById("Campo4").value = "";
document.getElementById("Campo4").style.visibility = "hidden";
}
return
}
</script>
</head>
<body>
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle"><p>
Acceso de Alumnos y Empleados. </p>
<form method="post" action="" name="formulario"
id="formulario">
<table width="54%" border="1">
<tr>
<td width="216" rowspan="6"><div align="center"><img
src="img/unisoftlogo.jpg" width="215" height="66"></div></td>
<td>Tipo de Usuario:</td>
<td><select name="select" onChange="Cambio(this)">
<option selected>...</option>
<option value="Alumno">Alumno</option>
<option value="Empresa">Empresa</option>
</select></td>
</tr>
<tr>
<td width="155"><label>Nombre de
Usuario:</label> </td>
<td width="203"><input type="text" size="20" name="Campo"
id="Campo" style="visibility:hidden"></td>
</tr>
<tr>
<td>Contraseña:</td>
<td><input type="text" size="20" name="Campo2" id="Campo2"
style="visibility:hidden"></td>
</tr>
<tr>
<td>Matricula:</td>
<td><input type="text" size="20" name="Campo3" id="Campo3"
style="visibility:hidden"></td>
</tr>
<tr>
<td>Sistema:</td>
<td><input type="text" size="20" name="Campo4" id="Campo4"
style="visibility:hidden"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Enviar"></td>
</tr>
</table>
</form> <p> </p></td>
</tr>
</table>
</body>
</html>