Advertisement

04.05.2005 at 04:44AM PDT, ID: 21376722
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

Automatically setting the attributes of a div element

Asked by BenSwitzer in JavaScript, Extensible HTML (XHTML)

Tags: , ,

I have a page that needs to get the user's screen size and automatically adjust the style of some divs based on the screen size.

Here is the code:
<html>
<head>
<title>Navy Enlisted Advancement System -- Online ordering and Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../cgi-bin/tirstyle1.css" type="text/css">

 

<script language="JavaScript" type="text/javascript">
function GetScreen()
{
  borderstyle = "border 1px none 000000";
   var scrWidth = window.screen.width;

  if(scrWidth == 1024)
  {
//      document.getElementById("lyrTop").style = "position:absolute; width:1000;left: 0px; height:50; z-index:1; border: 1px;background-attachment: scroll;background-image: url(../../coldmenu/BensNEASheader800.png);background-repeat: no-repeat;background-position: center;"
   //document.getElementById("lyrTop").style.backgroundImage=  "url(../../coldmenu/BensNEASheader1024.gif)";
   document.getElementById("leftlayer").style="height:540;left: 0px;"
   document.getElementById("Layer1").style="position:absolute;" + borderstyle + "; width:927; height:535; z-index:3; left: 65; top: 53px; overflow: auto; vertical-align: middle;"
  }
  else if(scrWidth == 800)
  {
   document.getElementById("lyrTop").style="position:absolute; width:765;left: 0px; height:50; z-index:1; border: 1px;background-attachment: scroll;background-image: url(../../coldmenu/BensNEASheader800.png);background-repeat: no-repeat;background-position: center;"
   document.getElementById("leftlayer").style="height:390;left: 0px;"
   document.getElementById("Layer1").style="position:absolute;" + borderstyle + "; width:927; height:535; z-index:3; left: 65; top: 53px; overflow: auto; vertical-align: middle;"
  }
  else if(scrWidth == 640)
  {
  document.getElementById("lyrTop").style="position:absolute; width:620;left: 0px; height:50; z-index:1; border: 1px;background-attachment: scroll;background-image: url(../../coldmenu/BensNEASheader640.png);background-repeat: no-repeat;background-position: center;"
  document.getElementById("leftlayer").style="height:200;left: 0px;"
   document.getElementById("Layer1").style="position:absolute;" + borderstyle + "; width:927; height:535; z-index:3; left: 65; top: 53px; overflow: auto; vertical-align: middle;"  
  }
  else
  {
   document.getElementById("lyrTop").style= "position:absolute; width:1000;left: 0px; height:50; z-index:1; border: 1px;background-attachment: scroll;background-image: url(../../coldmenu/BensNEASheader1024.gif);background-repeat: no-repeat;background-position: center;"
   document.getElementById("leftlayer").style="height:540;left: 0px;"
   document.getElementById("Layer1").style="position:absolute;" + borderstyle + "; width:927; height:535; z-index:3; left: 65; top: 53px; overflow: auto; vertical-align: middle;"  
  }
 // alert(document.getElementById("logomain").width+ "-" + document.getElementById("logomainimg").src + "-" +   document.getElementById("logofill").background + "-" +  document.getElementById("logofill").height  + "-" +   document.getElementById("logoimgtext").src + "-" +   document.getElementById("linksfill").background + "-" +  document.getElementById("linksfill").height);
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<form>


<div id="lyrTop"  style="position:absolute; width:765;left: 0px; height:50; z-index:1; border: 1px;background-attachment: scroll;background-image: url(../../coldmenu/BensNEASheader800.png);background-repeat: no-repeat;background-position: center;">
</div>
 
   
 

<div id="leftlayer" class="leftlayer">
<div align="left" style="position:absolute;left: 3px;">

 
</div>
</div>


<div id="Layer1" class="darkblue">

</div>
</form>
<script language="JavaScript" type="text/javascript">
GetScreen();
</script>
</body>
</html>

When I do this I get a Member not found error on line 31.  Im not quite sure what the problem is here.  Any help is appreciated.Start Free Trial
[+][-]04.05.2005 at 04:50AM PDT, ID: 13705970

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Extensible HTML (XHTML)
Tags: div, found, member
Sign Up Now!
Solution Provided By: mplungjan
Participating Experts: 2
Solution Grade: B
 
 
[+][-]04.05.2005 at 04:51AM PDT, ID: 13705973

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.05.2005 at 06:03AM PDT, ID: 13706579

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42