Reputation: 5993
var height = (library.window_dimensions().height - 200) + 'px';
document.getElementById('activity-feed').style.height = height;
IE8 reports an error with the second of these two lines. (The function returning a height and width returns integers for the window's height and width.)
What is IE complaining about?
--EDIT--
I was going off code at http://www.howtocreate.co.uk/tutorials/javascript/browserwindow that accommodates IE4 but perhaps not recent versions of IE; I'd just expected that someone thorough enough to address IE4 would make sense for common versions of IE. The code was returning 0 for the window height, and the next line was complaining that it was given a height of -200px.
The code given is:
function alertSize() {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
window.alert( 'Width = ' + myWidth );
window.alert( 'Height = ' + myHeight );
}
So, my next question: without necessarily reaching back past IE6, how do I determine width and height so that e.g. IE8 gets the right height?
Upvotes: 0
Views: 143
Reputation: 5145
most likely, you are not reaching the element. The document.getElementByID() is a funky function. You are trying to set height on a null/undefined.
Upvotes: 2