I am trying to put footer at bottom.I get screen height by js and put this value in a variable. Now i want to put this variable in css height.(How can i apply height 700px to heightscr, please see code below) Thanks
<script type="text/javascript">
function footerlocation(){
var heightscr=(screen.availHeight);
var myElement = document.querySelector(".container");
myElement.style.height = "700px";
myElement.style.backgroundColor = "#ff0000";
}
</script>
()you have aroundscreen.availHeightdon't do anything.screen.availHeightdoes anything at all. You give anything in JS a value with an=operator. LHS (left hand side) becomes what follows the operator, so:myelement.height = heightscrwould make myelement's height property the value of heighsc variable.