开发者

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
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜