Ver Mensaje Individual
  #16 (permalink)  
Antiguo 10/05/2013, 07:16
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: TRUCASO para capturar este innerHTML: <!-- <div id="fin">datos y + datos..

Claro, es porque empezamos a examinar a partir del tag html, que en javascript es document.documentElement. Para lo que vos querés necesitás capturar al nodo padre del nodo html, que en javascript es document.documentElement.parentNode:
Código PHP:
<!DOCTYPE html
<
html
<
head
<
meta charset="utf-8" /> 
<
title></title
<!-- 
hola -->
<
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
  } 
  
    
onload=function(){alert(htmlTree(document.documentElement.parentNode));}; 
</script> 
</head> 

<body> 
<!-- chau --> 

</body> 
</html>
<!-- uf! -->