开发者

Javascript function who return length of html?

Using Javascr开发者_StackOverflow中文版ipt, is there a way that I can determine the size of a document excluding any markup?


I think what you want is something like $(document).text().length. It's not going to be completely exact, but it's going to be a good aproximation.


Here it is:

document.body.innerHTML.replace(/<[^>]*>/g, '').length
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜