How to get window height and width within all major browsers?

Dear Experts!

I want to make a div as a semi transparent layer (opacity 80%) on top of the whole body of the web page.

How do I get the height and width of the window/body of the html page to set on the div?

It needs to be a cross browser solution.

Thank you

Regards
Henrik_NyholmAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Roman GhermanSenior Software EngineerCommented:
<div id="loadingContainer">
    <!--[if lt IE 6.5]><iframe></iframe><![endif]-->
</div>


#loadingContainer
{
      cursor: wait;
      text-align: center;
      position: absolute;
      filter: alpha(opacity=50);
      -moz-opacity: .50;
      opacity: .50;
      background-color: silver;
      width: 100%;
      height: 100%;
      z-index: 100;
}
0
Gurvinder Pal SinghCommented:
try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<style>
		html, body, div.transparent_class
		{
			width:100%;
			height:100%;
		}
		.transparent_class 
		{
			filter:alpha(opacity=80);
			-moz-opacity:0.8;
			-khtml-opacity: 0.8;
			opacity: 0.8;
			background-color:#777;
		}
	</style>
</HEAD>

<BODY>
	<div class="transparent_class"></div>
</BODY>
</HTML>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertCommented:
I suggest you look at the jQuery UI dialog. Takes away a lot of hassle with modal dialogs.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.