title: javascript function that accepts (#id).val() returns wrong value
body: <p>I have a button with the id="kill".</p>
  
  <p>Here is my JavaScript:</p>
  
  <pre><code>$("#kill").click(function(){ 
      getImage($(this).val()); 
  });
  
  function getImage(code){  
      var code, 
          imgstr;
      imgstr="mypath/"+code+".png";  
      return imgstr;
  }
  </code></pre>
  
  <p>Unfortunately, the wrong value is getting returned. But if I assign the value inside the function getImage, like this:</p>
  
  <pre><code>$("#kill").click(function(){ 
      getImage($(this).val()); 
  });
  
  function getImage(code){  
      var code="12", 
          imgstr;
      imgstr="mypath/"+code+".png";  
      return imgstr;
  }
  </code></pre>
  
  <p>Then it returns the correct value.  How can I fix this?</p>