Ver Mensaje Individual
  #6 (permalink)  
Antiguo 30/10/2008, 13:27
tanzer
 
Fecha de Ingreso: octubre-2008
Mensajes: 29
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: combo and hide

No entendi muy bien el codigo la final la ultima linea no la puedo sacar tampoco asi que la tuve que ocultar. Me quedo asi.

Código:
<!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>Agenda</title>
<script>
function mostrarMSG2(combo)
{
total = combo.options.length;
for(i=0; i<total; i++)
{
if (combo.options[i].selected)
{
document.getElementById('mensaje').innerHTML=combo .options[i].value;
}
}
if (combo.options[2].selected)
{
text2.style.display="block";
}
else 
text2.style.display="none";
}

</script>
</head>

<body>
<form>
<select id="combo" onchange="mostrarMSG2(this)">
<option value="mensaje 1">amigos</option>
<option value="mensaje 2">colegio</option>
<option value="mensaje 3">agregar</option>
<option value="mensaje 4">trabajo</option>
</select>
</form>
 <input name="text2" type="text" id="text2" value="correcto" style="display:none" >
<div id="mensaje" style="display:none"></div>
</body>
</html>