I wanted to set the div height of element to innerHeight of the browser. I dont want css or jQuery to take place here. It has to change its height dynamically with window resize. So i made this script and its not working as i thought.
Here is my code:
window.onload=
window.onresize=function(){
var left = document.getElementById("left");
var height = window.innerHeight;
left.style.height = 'height +('px')';
}
Can someone correct my code and make it work. Any help will be appreciated.
Thank You.
You can add height:500px;
to the left element. and see what i want. But i need to fit the browser height.
SOLVED
//<![CDATA[
function resize()
{
var heights = window.innerHeight;
document.getElementById("left").style.height = heights -50 + "px";
}
resize();
window.onresize = function() {
resize();
};
//]]>
Thanks to Thirumalai murugan's answer.