title: Javascript if statement won't trigger
body: <p>I've been building this site that will get run an API depending on the search parameters. I used an if statement to determine the dropdown value. But for some reason the if statment doesn't run. Is there something I am doing wrong please? Here's the code</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;script type="text/javascript"&gt;&lt;/script&gt;
  &lt;title&gt;Testing&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="bestbuysearch"&gt;
  &lt;select name="selection" onchange="setvalue()"&gt;
  &lt;option value="default"&gt;Select Category(Optional)&lt;/option&gt;
  &lt;option value="abcat0100000"&gt;TV &amp; Home Theater&lt;/option&gt;
  &lt;option value="abcat0207000"&gt;Musical Instruments&lt;/option&gt;
  &lt;option value="abcat0300000"&gt;Car, Marine &amp; GPS&lt;/option&gt;
  &lt;option value="abcat0400000"&gt;Cameras &amp; Camcorders&lt;/option&gt;
  &lt;option value="abcat0500000"&gt;Computers &amp; Tablets&lt;/option&gt;
  &lt;option value="abcat0600000"&gt;Movies &amp; Music&lt;/option&gt;
  &lt;option value="abcat0700000"&gt;Video Games&lt;/option&gt;
  &lt;option value="abcat0800000"&gt;Mobile Phones&lt;/option&gt;
  &lt;option value="abcat0900000"&gt;Appliances&lt;/option&gt;
  &lt;option value="pcmcat142300050026"&gt;Outlet Center&lt;/option&gt;
  &lt;option value="pcmcat242800050021"&gt;Health, Fitness &amp; Sports&lt;/option&gt;
  &lt;option value="pcmcat245100050028"&gt;Office&lt;/option&gt;
  &lt;option value="pcmcat248700050021"&gt;Home&lt;/option&gt;
  
  &lt;/select&gt;
  &lt;input type='text' id="item" placeholder='Search Here!' style='margin-top: 10px' size="70" maxlength=150 width="100px" /&gt;       
  &lt;input type='submit' value="Search" onclick="getstring(document.getElementById('item').value)"/&gt; 
  &lt;/form&gt;
  
  
  &lt;script&gt;
  function setvalue(){
  dropval=document.getElementsByName("selection")[0];
  maindropval=dropval.value;
  } 
  function getstring(x){
      //link="http://api.remix.bestbuy.com/v1/products(name="+x+"*)?show=sku,name,regularPrice&amp;apiKey=ydpyq9h9cmpmzaakbawv9mzk";
      //link2= "http://api.remix.bestbuy.com/v1/products(name=ipad|shortDescription=32gb*)?show=sku,name,shortDescription&amp;apiKey=ydpyq9h9cmpmzaakbawv9mzk";
      link1="http://api.remix.bestbuy.com/v1/products(name="+x+"*)?show=sku,name,regularPrice,shortDescription&amp;apiKey=ydpyq9h9cmpmzaakbawv9mzk";  
      link2="http://api.remix.bestbuy.com/v1/products(categoryPath.id="+maindropval+"&amp;name="+x+"*)?show=sku,name,shortDescription,regularPrice,&amp;apiKey=ydpyq9h9cmpmzaakbawv9mzk";
      if(maindropval=='default'){ 
      alert("worked");
          window.open(link1);}    
      else{
          window.open(link2);}
  
  
  }
  function getresult(value){
  link="http://api.remix.bestbuy.com/v1/products(name="+x+"*)?show=sku,name,rating,regularPrice&amp;apiKey=ydpyq9h9cmpmzaakbawv9mzk";
  alert("step 2 completed");
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>