<head> <script>window.onload = function(){alert(document.body.innerHTML)}</script> <body> <p id = "id1">текст1 <p>текст2</p> </p> </body>