开发者

How to convert content of html page to single string using javascript?

开发者 https://www.devze.com 2023-03-11 22:31 出处:网络
How to convert content of HTML page to s开发者_运维技巧ingle string using JavaScript? my HTML page contains labels, text boxes

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
0

精彩评论

暂无评论...
验证码 换一张
取 消