<html> <body> <div id="myD"> <p id="myP">This is a sample text.</p> </div> <br> <input type="button" value="ownerDocument" onclick="function1();"> <script language="JavaScript"> function function1() { alert(document.all.myP.ownerDocument); } </script> </body> </html>