Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/12/2008, 10:46
Avatar de rudy69
rudy69
 
Fecha de Ingreso: octubre-2008
Ubicación: espndeportes.com
Mensajes: 195
Antigüedad: 15 años, 7 meses
Puntos: 7
Ayuda a mejorar este codigo

Buenas, me gustaria que me ayudaran un poco con este codigo, el funciona perfectamente, apenas he leido unas 5 paginas acerca de javascript y lo que se es casi nulo xD, gateando logre hacer este programa, a ver si me pueden ayudar a reducirlo mas o si hay alternativas mas faciles

Aqui pueden ver como funciona, disculpen la publicidad no se como poner ejemplos como he visto en las FAQ'S (tienen que esperar como 5 seg para que pueda correr, problemas con la publicidad y dar click fuera de ella o como sea ser pacientes si no les corre xd)
http://usuarios.lycos.es/rudychevez/prueba.php

Este es el codigo:
Código:
<html>
<head>
   <script language="javascript" type="text/javascript">
   function vera(){
   if (!document.getElementById) return false;
   fila = document.getElementById('hola1');
   fila.style.display = "";
   fila = document.getElementById('hola2');
   fila.style.display = "none";
   fila = document.getElementById('hola3');
   fila.style.display = "none";
   fila = document.getElementById('hola');
   fila.style.display = "none";    
   
   document.form1.monto.disabled = false;
   document.form1.cantidad.disabled = false;
   document.form1.tienda.disabled = false;
   
   document.form1.pais.disabled = true;
   document.form1.pais.value = document.form1.pais_.value;
   
   document.form1.estado.disabled = true;
   document.form1.estado.value = document.form1.estado_.value;   
   
   document.form1.ciudad.disabled = true;
   document.form1.ciudad.value = document.form1.ciudad_.value;
      
   document.form1.pagador.disabled = true;
   document.form1.pagador.value = document.form1.pagador_.value;  
    
   document.form1.servicio.disabled = true;
   document.form1.servicio.value = document.form1.servicio_.value;  
    
   }
   function verb(){
   if (!document.getElementById) return false;
   fila = document.getElementById('hola1');
   fila.style.display = "none";
   fila = document.getElementById('hola2');
   fila.style.display = "";
   fila = document.getElementById('hola3');
   fila.style.display = "none";
   fila = document.getElementById('hola');
   fila.style.display = "none";
   
   document.form1.monto.disabled = true;
   document.form1.monto.value = document.form1.monto_.value;
   
   document.form1.cantidad.disabled = true;
   document.form1.cantidad.value = document.form1.cantidad_.value;   
   
   document.form1.tienda.disabled = true;
   document.form1.tienda.value = document.form1.tienda_.value;   
   
   document.form1.pais.disabled = true;
   document.form1.pais.value = document.form1.pais_.value;
   
   document.form1.estado.disabled = true;
   document.form1.estado.value = document.form1.estado_.value;   
   
   document.form1.ciudad.disabled = true;
   document.form1.ciudad.value = document.form1.ciudad_.value;
      
   document.form1.pagador.disabled = true;
   document.form1.pagador.value = document.form1.pagador_.value;
   
   document.form1.servicio.disabled = false;
   }
   function verc(){   
   if (!document.getElementById) return false;
   fila = document.getElementById('hola1');
   fila.style.display = "none";
   fila = document.getElementById('hola2');
   fila.style.display = "none";
   fila = document.getElementById('hola3');
   fila.style.display = "";
   fila = document.getElementById('hola');
   fila.style.display = "none";
   
   document.form1.monto.disabled = true;
   document.form1.monto.value = document.form1.monto_.value;
   
   document.form1.cantidad.disabled = true;
   document.form1.cantidad.value = document.form1.cantidad_.value;   
   
   document.form1.tienda.disabled = true;
   document.form1.tienda.value = document.form1.tienda_.value; 
   
   document.form1.pais.disabled = false;
   document.form1.estado.disabled = false;
   document.form1.ciudad.disabled = false;
   document.form1.pagador.disabled = false;
   
   document.form1.servicio.disabled = true;
   document.form1.servicio.value = document.form1.servicio_.value;  
   } 

</script>
</head>


<body>
<form name="form1">

<br />
<input type="hidden" value="12" name="monto_">
<input type="hidden" value="123" name="cantidad_">
<input type="hidden" value="1234" name="tienda_">

<input type="hidden" value="12345" name="pais_">
<input type="hidden" value="234" name="estado_">
<input type="hidden" value="345" name="ciudad_">
<input type="hidden" value="456" name="pagador_">

<input type="hidden" value="6" name="servicio_">



<input type="radio" name="accion" onclick="vera()" value=1><font color=black size="-1" face="arial, helvetica">Modificar cantidades</font><br>
<input type="radio" name="accion" onclick="verb()" value=2><font color=black size="-1" face="arial, helvetica">Cambiar compa&ntilde;ia</font><br>
<input type="radio" name="accion" onclick="verc()" value=3><font color=black size="-1" face="arial, helvetica">Cambiar direccion</font><br>
<br />
<input type="text" value="2" name="monto" disabled><br />
<input type="text" value="2" name="cantidad" disabled><br />
<input type="text" value="2" name="tienda" disabled><br />
<br>
<input type="text" value="2" name="pais" disabled><br />
<input type="text" value="2" name="estado" disabled><br />
<input type="text" value="2" name="ciudad" disabled><br />
<input type="text" value="2" name="pagador" disabled><br />
<br>
<select name=servicio disabled>
<option value=0>Nuevo</option>
<option value=6 selected>Existente</option>
</select>

<br><br>
<font color=red size="-2" face="arial, helvetica" style="display:none" id="hola1">Puede modificar monto, moneda local y cargos, se hara un registro de esta accion.</font>
<font color=red size="-2" face="arial, helvetica" style="display:none" id="hola2">Solamente se permite camtiar la compa&ntilde;ia que uso el cliente, se guardara un registro de este movimiento.</font>
<font color=red size="-2" face="arial, helvetica" style="display:none" id="hola3">Puede cambiar: pais, estado, ciudad y pagador. No se hara reporte de este cambio</font>
<font color=red size="-2" face="arial, helvetica" style="display:" id="hola">Seleccione un accion</font>

</form>
</body>
</html>

Última edición por rudy69; 19/12/2008 a las 11:05