title: "if (location.href != example.com/page1 || example.com/page2)" Change CSS element
body: <p>When I use these similar JS code (the 2 immediately below), my output is wrong or doesn't show.
  Here is my codes in question:</p>
  
  <pre><code>if (location.href != "website.com/page1" || "website.com/page2")
     {
       element.style.backgroundColor='none';
     }
  </code></pre>
  
  <p>or with != and !==</p>
  
  <pre><code>if (location.href != "website.com/page1" || location.href != "website.com/page2")
     {
       element.style.backgroundColor='none';
     }
  </code></pre>
  
  <p>Here is how I'm using it with other code (simplified)</p>
  
  <pre><code>&lt;script&gt;
  var element = document.getElementbyId('idElement');
  
  if (location.href != "website.com/page1")
     {
       element.style.backgroundColor='blue';
     }
  if (location.href != "website.com/page2")
     {
       element.style.backgroundColor='green';
     }
   //HERE'S WHERE I PUT IT
  if (location.href != "website.com/page1" || "website.com/page2")
     {
       element.style.backgroundColor='none';
     }
   &lt;/script&gt;
  </code></pre>
  
  <p>Either nothing happens or the element doesn't work properly on other pages.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>More Info: I'm making a Tumblr theme and there are pages that will have certain post with different characteristics when viewed on different pages. I have to have this code in the top.</p>
  
  <p>Someone Suggested This: SOLVED</p>
  
  <pre><code>&lt;script&gt;
       window.onload = function ()
  
   var element = document.getElementbyId('idElement');
  
   if (location.href != "website.com/page1" &amp;&amp; location.href != "website.com/page2") 
      {
         element.style.backgroundColor='none'; 
      } 
    if (location.href == "website.com/page1") 
      {
         element.style.backgroundColor='blue'; 
      }
    if (location.href == "website.com/page2") 
          { 
         element.style.backgroundColor='green'; 
      }
  
  &lt;/script&gt; 
  </code></pre>