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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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]-->

      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;
Gurvinder Pal SinghCommented:
try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
		html, body, div.transparent_class
			-khtml-opacity: 0.8;
			opacity: 0.8;

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

Open in new window

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.
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

From novice to tech pro — start learning today.