title: javascript redirects doesn't open in same tab?
body: <p>I have been creating a webpage for the last few days and the concept in this webpage is that the user enters a custom text in a <code>textarea</code>.
  Then the value of that <code>textarea</code> will be treated with javascript.
  <code>if(x=="hello")</code> ,then javascript will have to redirect the user to another webpage but in the same tab and in the same window. 
  Unfortunately this is not working. I mean javascript redirect the webpage to another url but it's not in the same tab. </p>
  
  <p>PLEASE CAN ANYBODY HELP ME TO FIX MY ERROR?</p>
  
  <p>Note:Please do not give me answers with jQuery because I don't know how to use it</p>
  
  <p><strong>HTML CODE</strong></p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
     &lt;head&gt;
        &lt;script type="text/javascript" src="scripting1.js"&gt;&lt;/script&gt;
        &lt;style type"text/css"&gt;
               .inputtext
               {
               border:5px double #4f2d05;
               width:1378px;
               height:690px;
               background-color:#000000;
               font-family:monospace;
               font-size:28px;
               color:#00ff00;
               resize:none;
               }
               textarea:focus{outline: 0}
        &lt;/style&gt;
     &lt;/head&gt;
     &lt;body background="camouflage.jpg"&gt;
        &lt;table name="table" align="center"&gt;
           &lt;tr&gt;
              &lt;td&gt;
                 &lt;img src="header.png" /&gt;
              &lt;/td&gt;
           &lt;/tr&gt;
  
           &lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;
           &lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;
           &lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;
           &lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;
           &lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;
           &lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;
  
           &lt;form name="form1"&gt;
              &lt;tr&gt;
                 &lt;td&gt;
                    &lt;div align="center"&gt;
                       &lt;textarea 
                          class="inputtext" 
                          id="myTextarea" 
                          name="text1" 
                          align="center" 
                          placeholder="Enter command here...."&gt;
                       &lt;/textarea&gt;
                    &lt;/div&gt;
                 &lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                 &lt;td&gt;
                    &lt;input 
                       type="submit" 
                       name="submit" 
                       OnSubmit="myFunction();"
                       &gt;
                 &lt;/td&gt;
              &lt;/tr&gt;
           &lt;/form&gt;
        &lt;/table&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>JAVASCRIPT CODE (external .js file and html is linking to it)</strong></p>
  
  <pre><code>function myFunction(){
     var x = document.getElementById("myTextarea").value;
     if (x == "hello"){
        window.open('http://google.com/'
     }, '_self);
     }
  
     else{alert('ok i knew it'); }
  }
  </code></pre>