Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/07/2012, 13:53
Avatar de Dradi7
Dradi7
 
Fecha de Ingreso: junio-2008
Ubicación: Peru - Lima
Mensajes: 1.518
Antigüedad: 15 años, 10 meses
Puntos: 220
Respuesta: Input y select dependientes

Prueba con este codigo aunque en los navegadores antiguos ocurre problemas con el setAttribute

Código HTML:
Ver original
  1. <input type="text" name="precio" id="precio" onkeyup="changePrecio()"/>
  2. <select name="opciones" id="opciones" disabled="disabled">
  3.     <option value=1>Soles</option>
  4.     <option value=2>Dolares</option>
  5. <script language="javascript">
  6. function changePrecio(){
  7.     var precio = document.getElementById("precio").value;
  8.     var opciones = document.getElementById("opciones");
  9.     if(precio == null || precio == "")
  10.     {
  11.         opciones.setAttribute("disabled","disabled");
  12.     }else{
  13.         opciones.removeAttribute("disabled");
  14.     }
  15. }
__________________
La clave de todo triunfador es eliminar todas sus excusas y sus limitaciones