title: Changing CSS Values Using Javascript If/Else Statement
body: <p>I essentially know nothing when it comes to Javascript, so any help is appreciated. </p>
  
  <p>When a user is on a mobile phone, I want a div to popup with a link to my mobile website. Naturally, I don't want the popup to show when the user is on their desktop.</p>
  
  <p>My issue is that I can't get the javascript to apply the css.</p>
  
  <p>Here's the javascript that I'm using.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var isMobile = navigator.userAgent.match(/(iPhone|iPod|blackberry|android 0.5|htc|lg|midp|mmp|mobile|nokia|opera mini|palm|pocket|psp|sgh|smartphone|symbian|treo mini|Playstation Portable|SonyEricsson|Samsung|MobileExplorer|PalmSource|Benq|Windows Phone|Windows Mobile|IEMobile|Windows CE|Nintendo Wii)/i);
  
  if(isMobile){
  document.getElementById('mobile').style.display = 'block';
  }
  else{
  document.getElementById('mobile').style.display = 'none';
  }
  ;
  
  &lt;/script&gt;
  </code></pre>
  
  <p>This is the div:</p>
  
  <pre><code>&lt;div id="mobile" style="left:116px; position: absolute; top: 106px;"&gt;
  If you would like to visit our mobile website optimized for your device, click &lt;a href="http://m.website.org"&gt;here&lt;/a&gt;.&lt;/div&gt;
  </code></pre>
  
  <p>Any help is appreciated. I've tried figuring it out myself, but I've hit a road block.</p>
  
  <p>If you have a better, completely separate solution, that is welcome as well.</p>