title: Change body onclick to button Onclick
body: <p>i have this script that will open popup when click any body.
  how to change instead body click it should be button click or link click before the popup appear? Do i need to create button of anything. code much appreciate.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var win = window.open('http://google.com', "popup", 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=650, height=650, left = 300, top = 50');
  if (!win){
  //    alert("failed for most browsers");
      document.body.onclick = function () {
           window.open('http://google.com', 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=650, height=650, left = 300, top = 50');
      };
  }else {
      var thisdoc = document;
      //Is it Chrome?
      if(/chrome/.test(navigator.userAgent.toLowerCase())){
          setTimeout(function() {
              if ((win.innerHeight &gt; 0) == false){
  //                alert("failed for chrome");
                    thisdoc.body.onclick = function () {
                        window.open('http://google.com', 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=650, height=650, left = 300, top = 50');
                    };
               }
          }, 100);
      }else{
         win.onload = function() {
              if ((win.innerHeight &gt; 0) == false){
  //                alert("failed for others");
                    thisdoc.body.onclick = function () {
                       window.open('http://google.com', 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=650, height=650, left = 300, top = 50');
                    };
              }
         };
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>JS : FIDDLE : <a href="http://jsfiddle.net/ayiem999/678Ru/" rel="nofollow">http://jsfiddle.net/ayiem999/678Ru/</a> ( WITH BUTTON CREATE. PLEASE PLAY)</p>
  
  <p><strong>MY ANSWER FOR THIS QUESTION FOR REFERENCE :</strong></p>
  
  <pre><code>&lt;button id="3" onclick="reply_click(this.id)"&gt;B3&lt;/button&gt;
  
  &lt;script type="text/javascript"&gt;
  function reply_click(clicked_id)
  {
  window.open('http://google.com', 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=650, height=650, left = 300, top = 50');
  }
  &lt;/script&gt;
  </code></pre>