I am trying to resize a div onload without having a javascript function in the header. So far my code looks like the code below, and while I am somewhat familiar with javascript, I am very much so a beginner.
What I am wanting to do is take a div that has a height set in the stylesheet of 100%, and subtract 60px of height on load. Am I even close, or am I lost?
EDIT: I would not be opposed to other methods of doing this. I just don’t know of any other way.
<div id="pageContent" onload="document.this.style.height = clientHeight - '60px';">
I have used jQuery, as detecting window height is prone to cross-browser compatability issues. It is good practice to keep clear seperation of markup, css style, and JavaScript functionality.
Here is a coded example of what I believe you’re trying to achieve:
http://jsfiddle.net/AKmaB/2/
For if you haven’t used jQuery before, make sure you include this before any of your other JavaScripts within your web page source:
Inclusion of jQuery