Forum Moderators: open
<script type=text/javascript>
function adjustHeight()
{
var col_1 = document.getElementById("content-col-1");
var col_2 = document.getElementById("content-col-2");
var nav3 = document.getElementById("navbar3");
var adj1 = document.getElementById("adj1");
var adj2 = document.getElementById("adj2");
var adj_height = Math.max(col_1.offsetHeight, col_2.offsetHeight) - nav3.offsetHeight - (adj2.offsetHeight / 2) - 10;
document.getElementById('navbar3').style.paddingBottom = adj_height + "px";
}
</script>
According to IE, the error is in the final line, character 2 reported as "invalid argument"...does anyone recognize the problem? The page can be viewed at www.careercenter.uiuc.edu
We'll probably need to know more. Meanwhile, you could try outputting the value that you're getting..
alert(adj_height + "px") Slip that in after the calculation (but before the attempted assignment to the element).
I don't know how you'd do that, apart from simply zeroing all negative values:
if(adj_height<0) adj_height = 0;
Overall, it may be a good idea to pop over to the CSS forum [webmasterworld.com], and ask them if they have a good template for a 2 column page. You might be able to avoid any scripting.
{
var col = document.getElementById("content-col-1A");
var nav3 = document.getElementById("navbar3");
var adj1 = document.getElementById("adj1");
var adj2 = document.getElementById("adj2");
var adj_height = col.offsetHeight - nav3.offsetHeight - (adj2.offsetHeight / 2) - 10;
var abs_height = Math.abs(adj_height);
document.getElementById('navbar3').style.paddingBottom = abs_height + "px";
}
This gets rid of the negative value and the function sitll works properly, however, now I'm getting an error in line 39 char 2 "Object Required".
The line is
var adj_height = col.offsetHeight - nav3.offsetHeight - (adj2.offsetHeight / 2) - 10;
What is wrong with the syntax there?