title: Javascript button and document.location
body: <p>I'm trying to do something with javascript (I'm a beginner and I'm studying it) and I'd like to know how can I open a link saved in a variable. I'm trying with ...</p>
  
  <pre><code>&lt;input type="button" onclick="document.location.href=Query;" /&gt;
  </code></pre>
  
  <p>Where Query is a variable in the method Ricerca that works with another button</p>
  
  <pre><code>function ricerca()
          {
              var Link = "http://www.mysite.com/search?q=variabile&amp;k=&amp;e=1";
  
              var Name= document.getElementById('utente').value;
  
              var Query = Link.replace("variabile",Name);
  
              alert(Query); 
              return false;
          } 
  </code></pre>
  
  <p>the other button generates a custom search link ...</p>
  
  <pre><code>input type="text" id="utente"&gt;
  &lt;input type="submit" value="Click me" onclick="return ricerca();" /&gt; 
  </code></pre>
  
  <p>What's wrong with my code?</p>