title: Close modal dialog with returning a value in javascript?
body: <p>I need to close the modal dialog with return a value in a same function</p>
  
  <p>I cannot write code as follow,because when a returning a value, next line never be excuted,</p>
  
  <pre><code>function butOK_OnClick() {
      return "OK";
      window.close();
  }
  </code></pre>
  
  <p>so is this the right way ?</p>
  
  <pre><code>function butOK_OnClick() {
      window.returnvalue = "OK";
      window.close();
  }
  </code></pre>
  
  <p>or what is the best way to do this ?</p>