Hi

How can I access the DOM (inner html).

I need to capture the innerhtml (the complete html , body structure)of the source page and then be able to open another html page using this inner html of the page selected.

I tried different methods like using the ajax calls and document.getElementById.innerHtml....
but they only retrieve the source (not the complete html --- html that we see in fire bug)

Can any body please help me on this issue (any examples ).

thanks
Nash

Three methods of document object can be used :
1. document.getElementsByTagName("html");
2. document.getElementById("id");
3. document.getElementsByName("elename");

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html   id="p1" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Inner HTML</title>
   <script type="text/javascript">
      function show() {
            var t=document.getElementsByTagName("html").item(0);
            alert(t.innerHTML);
         }
   </script>  
</head>
<body>
    <form id="form1">
      <div>
        Something...
         <button onclick="show()">Show InnerHTML</button>
      </div>
    </form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.