title: Javascript changing background color
body: <p>I tried to change a background color with javascript and it didn't work out, and after lots of trying I didn't find any problem.</p>
  
  <pre><code>var x=1;
  
  switch(x) {
      case 1: {
          document.getElementsByClassName("gallery").style.backgroundColor="blue";
      }
  }
  </code></pre>
  
  <p>I don't see any need to copy html or css to here. If this code is fine though I'll edit and add the other codes.</p>
  
  <p>Edit: Html added, as you requested.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;פרדס מרים ומרדכי&lt;/title&gt;
  &lt;link href="../../CSS.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script language="JavaScript" src="Album1.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div id="wrapper"&gt;
        &lt;div id="header"&gt;&lt;/div&gt;
        &lt;div id="menu"&gt;
          &lt;pre class="menu1"&gt;&lt;a class="menu1" href="../../index.html"&gt;דף הבית&lt;/a&gt;             &lt;a class="menu1" href="../../HowToArrive.html"&gt;כיצד מגיעים&lt;/a&gt;             &lt;a class="menu1" href="../../HowItAllBegan.html"&gt;איך הכל התחיל&lt;/a&gt;             &lt;a class="menu1" href="../../Albums.html"&gt;אלבומי תמונות&lt;/a&gt;             &lt;a class="menu1" href="../../Contact.html"&gt;צור קשר&lt;/a&gt;&lt;/pre&gt;
          &lt;/div&gt;
        &lt;div id="main"&gt;
          &lt;div class="gallery_bg"&gt;    
              &lt;div class="gallery"&gt;&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Edit: CSS added. I believe you only need the part referring to the gallery class. The whole code is really long, if you need it I'll add it too, just say.</p>
  
  <pre><code>        .gallery {
              width:550px;
              height:550px;
              -webkit-background-size: 550px 550px;
              -moz-background-size: 550px 550px;
              background-size: 550px 550px;
              border:#fff 3px solid;
              margin:0 auto;
          }
  </code></pre>