Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/09/2012, 11:01
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: como se pone el contenido de un div en la variable?

Para darle un poco de sentido a eso que querés hacer, habría que limpiar el contenido del area de texto tras presionar le botón, si no no solo vas a estar agregandp texto, sino repitiendo una y otra vez lo ya escrito
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. <script type="text/javascript">
  7. //<![CDATA[
  8. function llenarDIV(){
  9. var obj = document.getElementById('destino');
  10. obj.innerHTML += ' ' + document.getElementById('mensaje').value;
  11. document.getElementById('mensaje').value = "";
  12. }
  13. //]]>
  14. </head>
  15. <form action="#">
  16. <textarea tabindex="1" rows="4" cols="40" id="mensaje" style="width:694px;">
  17.  <input type="button" value="Cambiar" onclick="llenarDIV();" />
  18.  </form>
  19. <div id="destino"></div>
  20. </body>
  21. </html>
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.