Ver Mensaje Individual
  #10 (permalink)  
Antiguo 10/05/2013, 06:04
Anarko
 
Fecha de Ingreso: febrero-2004
Mensajes: 1.987
Antigüedad: 20 años, 2 meses
Puntos: 22
Respuesta: TRUCASO para capturar este innerHTML: <!-- <div id="fin">datos y + datos..

Cita:
Iniciado por Panino5001 Ver Mensaje
Fijate si te sirve
Muchas gracias.

Funciona muy bien si los comentarios están ANTES del JS.

Pero aki no retorna:
Código:
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
	<p>Cantidad de info...</p>
<script type="text/javascript">
function htmlTree(obj){
    var str = "";
    if (obj.hasChildNodes()) {
      var child = obj.firstChild;
      while (child) {
          if (child.nodeType === 8) {
               str +=child.nodeValue + '\n';
          }
        if (child.nodeType === 1) {
          str += htmlTree(child);
        }
        child = child.nextSibling;
      }
    }
   
    return str;
  }
 
   
    alert(htmlTree(document.documentElement));
</script>
<!-- hola -->
	<p>Cantidad de info...</p>
<!-- chau -->
</body>
</html>