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.

Recommended Answers

All 3 Replies

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;
		
	};

This is how I'm getting wHeight:

var wHeight = window.innerHeight;

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

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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.