0

Hello everyone,

I'm having an issue that's only appearing in Internet Explorer browsers. It works fine in Firefox and Chrome.

var yDiff = wHeight - 102;
login.style.top = yDiff+"px";

The line of code highlighted in red is triggering an "invalid argument' error in IE browsers but not others.

2
Contributors
3
Replies
9
Views
7 Years
Discussion Span
Last Post by scrappedcola
0

How are you getting the value wHeight? You probably are using a value that isn't used in IE but it is in FF and others. If you are getting the Height of an element you need to use

if (self.innerHeight) {
		
		// all except Explorer
		var width = self.innerWidth;
		var height = self.innerHeight;
		
	} else if (document.documentElement && document.documentElement.clientHeight) {
		
		// Explorer 6 Strict Mode
		var width = document.documentElement.clientWidth;
		var height = document.documentElement.clientHeight;
		
	} else if (document.body) {
		
		// other Explorers
		var width = document.body.clientWidth;
		var height = document.body.clientHeight;
		
	};

Edited by scrappedcola: n/a

0

This is how I'm getting wHeight:

var wHeight = window.innerHeight;

EDIT: Thank you for that, it's all working now! :D

Edited by Zurompeta: n/a

0

yea innerHeight isn't supported by IE. I had edited my previous post with the proper property. For general IE use

var height = document.body.clientHeight;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.