Page Height in core Javascript

From Code Trash
Jump to: navigation, search
function changeheight() {
 
	var di = document.getElementById('divid')
	di.style.height = pageHeight() + 'px'
}
 
function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;}

an another function to find the page height including the scroll height

function getscrollheight(){
     var D = document;
     return Math.max(Math.max(D.body.scrollHeight,D.documentElement.scrollHeight), Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), Math.max(D.body.clientHeight, D.documentElement.clientHeight));
};