Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/12/2012, 13:08
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: hacer igual el value de un elemento con el valor de otro

Si se puede, definiendo la script posteriormente a la generación del elemento en el DOM

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. </head>
  7. <form action="#">
  8. <input type="text" id="val_cua"  value="5" />
  9.  <input type="text" value="" name="total_objecion" id="total_objecion"  />
  10. </form>
  11.  
  12. <script type="text/javascript">
  13. //<![CDATA[
  14. document.getElementById('total_objecion').value = document.getElementById('val_cua').value;
  15. alert(document.getElementById('total_objecion').value);
  16. //]]>
  17. </body>
  18. </html>

Lo que has hecho está decididamente mal, el único atributo de un input que te va a aceptar javascript es un evento

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.