Pop up window help

Discussion in 'JavaScript' started by Om ji Kesharwani, Aug 16, 2010.

  1. #1
    I want to open a popup window which fetch country name from table and after click on the country name into the popup window the country name should transfer to parent window textbox.
    Please help me:(
     
    Om ji Kesharwani, Aug 16, 2010 IP
  2. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you are fetching data from a table and you want it in real time you should use AJAX.
     
    Imozeb, Aug 16, 2010 IP
  3. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #3
    I don't get exactly what exactly you want, but it should be something like this:
    
    <html>
       <head>
       <script type="text/javascript">
       function openlol(id) {
          myWindow = window.open ("","mywindow","width=500,height=500"); // the command you use to open new window
          var cols = document.getElementsByTagName("td");
          var country = cols[id].innerHTML;
          myWindow.document.write(country);
          myWindow.focus( ); 
       }
       </script>
       </head>
       <body>
    
          <table border="1" id="country">
             <tr>
                <td onclick="openlol(0);">Canada</td>
             </tr>
             <tr>
                <td onclick="openlol(1);">USA</td>
             </tr>
          </table>
    
       </body>
    </html>
    
    HTML:
    There's no need for ajax for something as simple as this. :)
     
    Rainulf, Aug 16, 2010 IP
  4. Googl

    Googl Active Member

    Messages:
    509
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    75
    #4
    He might have to use Ajax, otherwise why would he have to transfer the country name to a new window then back... You might have to use Ajax and open a new page you've created containing another JavaScript. The open it. Use the new page to connect with the parent page.

    To fetch from a MySQL table you'll need to use Ajax.
     
    Googl, Aug 17, 2010 IP
  5. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #5
    I don't think that's possible with ajax alone, he'll have to use server-side language like PHP to fetch mysql tables. Plus, his question is ambiguous. I don't know if he meant html table or mysql table.. If you read my example, it's html table.
     
    Rainulf, Aug 17, 2010 IP
  6. Om ji Kesharwani

    Om ji Kesharwani Peon

    Messages:
    211
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sorry for my bad explanation. Thanks for your replies the problem is solved. I wanted to fetch data from Mysql table to my pop up window.

    Now another problem is how to prevent the pop up window to get minimized when user click on the parent window it should be closed not minimize.
     
    Om ji Kesharwani, Aug 17, 2010 IP