获取文档高度和元素的高度

获取文档的高度:

js:document.body.scrollHeight  这个会包括margin值

jquery:$(document).height();

 

获取元素的高度:

js:document.getelementbyid('').offsetHeight; 这个不会包含margin值

jquery:$('element').height();

你可能感兴趣的:(JavaScript)