How to convert content of html page to single string using javascript?
How to convert content of HTML page to s开发者_运维技巧ingle string using JavaScript?
my HTML page contains labels, text boxes
Thanks in advance........
You can display like this in script
<script>
var content = document.body.innerHTML;
alert (content);
</script>
This will output to console the whole content of the body tag of your page.
console.log(document.body.innerHTML);
This will get you the entire page between and including the <html>
tags:
document.getElementsByTagName('html')[0].outerHTML
精彩评论