title: Calling string from one function into another doesent seem to work., why?
body: <p>So I have this code and it does not seem to work. The thing I want it to do is to call the "together" from the function "go" in the function "second". What am i doing wrong?</p>
  
  <p>The program was initially supposed to take what is in the input-text and add it with the ".com" or the ".no"(depending on what u checked) and redirect to that page. But I only want to call the "together" in the "second" function. Is there any better way to do it?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt; 
  &lt;html&gt; 
  &lt;head&gt; 
  &lt;title&gt;A Basic Form&lt;/title&gt; 
  &lt;link rel="stylesheet" type="text/css"&gt;
  &lt;style type="text/css"&gt; 
  
  &lt;/style&gt; 
  &lt;/head&gt; 
  &lt;body&gt;
  
  
  &lt;fieldset&gt;
   &lt;legend&gt;Redirection: &lt;/legend&gt;
    &lt;div&gt;
     &lt;label&gt;Where do you want to go?&lt;/label&gt;
     &lt;input type="text" id="input" name="input" size="7"&gt;
     &lt;input type="button" id="submit" name="submit" value="Submit" onclick="go()"&gt;
    &lt;/div&gt;
    &lt;div&gt;
     &lt;input type="radio" id="no" name="end" value=".no"&gt;
     &lt;label for="no"&gt;.no&lt;/label&gt;&lt;br /&gt;
     &lt;input type="radio" id="com" name="end" value=".com"&gt;
     &lt;label for="com"&gt;.com&lt;/label&gt;
     
    &lt;/div&gt;
  &lt;/fieldset&gt;
  &lt;script type="text/javascript"&gt;
   var end = "";
   var input = document.getElementById("input").value;
   
   function go(end, input){
    
    if (document.getElementById("no").checked){
     end = document.getElementById("no").value;
    }else if (document.getElementById("com").checked){
     end = document.getElementById("com").value;
    }else{
     alert("Please Choose a category!"); 
    }
   
    var together = input + end;
    // window.location.replace("http://www." + together);
    }
    second(together);
    
   function second(together){
    alert(together);
   }
   
  &lt;/script&gt;
  &lt;/body&gt; 
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>