I wanted to set the height of the div element in the innerHeight of the browser. I don't want css or jQuery to have a place here. It should dynamically change its height with the resizing of the window. Therefore, I made this script and did not work 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 fix my code and make it work. Any help would be appreciated.
Thanks.
jsFIDDLE
You can add height:500px; to the left element. and see what i want. But I need to match the height of the browser.
solvable
//<![CDATA[ function resize() { var heights = window.innerHeight; document.getElementById("left").style.height = heights -50 + "px"; } resize(); window.onresize = function() { resize(); }; //]]>
Thanks Thirumalai murugan answer.
source share