代码如下:
function focus_footer(h){ window.onresize = function() { if (document.body.scrollHeight < h) { document.getElementById(‘footer‘).style.display = "none"; } else { document.getElementById(‘footer‘).style.display = "block"; } }; }
最后一步就在需要的页面执行:
var h = document.body.scrollHeight; focus_footer(h);
原文:http://www.cnblogs.com/xushengguan/p/7750142.html