Displaying the HTML source code in the same page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dasrasmikant
    New Member
    • Jan 2008
    • 30

    Displaying the HTML source code in the same page

    Hello,
    I want to print the HTML source code in that page by clicking on a button. So can it possible???
  • mmurph211
    New Member
    • Jan 2008
    • 13

    #2
    This code will show it in the page:

    Code:
    <input type="button" onclick="document.getElementById('source').value = documentElement.innerHTML;" value="View Source" />
    
    <textarea id="source" style="width:900px;height:700px;"></textarea>
    Could print that

    Comment

    • dasrasmikant
      New Member
      • Jan 2008
      • 30

      #3
      Thanks mmurph211
      Its working.

      Comment

      Working...