title: create a pop up window inside function
body: <p>What my code trying to do is to add new group if it is not yet created,well, that's work fine now however I also want to open a new popup window as soon as the group is created, prompting user to invite other, but I don't seems to get my work working, any idea on how to make it works?</p>
  
  <p>thanks</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  
  function addGroup()
  {
    x=document.getElementById("group").getElementsByTagName("p");
    groups=document.getElementById("groupName");
    var j=0,i=0;  
  
  
    if   (groups.value=="")
    {
        alert('must create one group');
    }
  
  
  
     for (i=0;i&lt;x.length;i++)
     { 
       if (x[i].innerHTML == groups.value)
       {
           alert('the group name is already created');
           return false;
       }  
     }
  
  
  
     if (!j)
     {
        var newNode=document.createElement('p');
        var newString=document.createTextNode(groups.value); 
        newNode.appendChild(newString);
        x[0].parentNode.appendChild(newNode);
        newWindow();
     }
  }
  
  function newWindow()
  {
      window.open('http://invite Others.html','invite  
                           others','width=400,height=200,toolbar=yes,                             
        location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,
                               resizable=yes');
        winObj.focus();
  }
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div id="group"&gt;
  &lt;ul&gt;
     &lt;p&gt;Group03&lt;/p&gt;
     &lt;p&gt;Group02&lt;/p&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;p&gt;&lt;input type="text" id="groupName" size="84" maxlength="84" value=""/&gt;&lt;/p&gt;
  &lt;p&gt;&lt;input type="button" value="create" onclick="addGroup()" /&gt;&lt;/p&gt;
  &lt;p&gt;&lt;input type="button" value="remove" onclick="removeNo()"/&gt; &lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>