Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts

    HOW TO? -- puting a bunch of info into a popup from parent page?????

    Okay,

    I have a LOT of info that I am 'hiding' on a page. I am hiding this info via a div tag.

    Okay, I want to let a user click a 'popup' link, and then have that information put into a popup window.

    The problem is, the amount of information is not so little to do a simple document.write and reference back to some variable.

    I have ALOT of info that I am 'hiding' on the parent page. Basically, I only want to hit the server one time for this page, thus I give back the html page all information. The user then selects a link, and the popup shows the "rest of the info".

    Is there a way to do this without a bunch of document.writes and such in the popup.

    Can I somehow reference the contents of a div tag and display it in the popup? Whole tables and content and such?

    please advise.

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    how much information in KB mate? Also, does it require manipulation before putting into the popup?

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    hmmm,

    well, I am gonna be formatting it on the parent page....

    so, the proper tables and headers and everything is in there...ala..

    all the info here...complicated table structure showing
    pricing figures and such. There could like 4 of these tables but with
    much more data.
    <div id="somediv">
    <table>
    <tr>
    <td>item</td>
    <td>price</td>
    <td>size</td>
    <td>color</td>
    </tr>
    <tr>
    <td>car</td>
    <td>$55000</td>
    <td>med</td>
    <td>red</td>
    </tr>
    <tr>
    <td>shoe</td>
    <td>$4</td>
    <td>11</td>
    <td>white</td>
    </tr>
    </table>
    </div>

    The amount of the KB for the popup, hmmm. I would imagine about, actually I don't know.
    A fair amount. Like 3 fairly large tables with pricing/seating/product info..

    thanks

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Here is one way.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script type="text/javascript">
    function openWin(url,what){
    newwin=window.open(url,'','width=600,height=600,menubar=0,toolbars=0,scrollbars=1,status=0');
    newwin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n');
    newwin.document.write('<html>\n<head>\n<title></title>\n</head>\n<body>\n');
    newwin.document.write(document.getElementById(what).innerHTML);
    newwin.document.write('\n</body>\n</html>');
    newwin.document.close();
    }
    </script>
    </head>
    
    <body>
    <a href="index.html" onclick="openWin(this.href,'somediv');return false">Open win</a>
    <div id="somediv">
    <table>
    <tr>
    <td>item</td>
    <td>price</td>
    <td>size</td>
    <td>color</td>
    </tr>
    <tr>
    <td>car</td>
    <td>$55000</td>
    <td>med</td>
    <td>red</td>
    </tr>
    <tr>
    <td>shoe</td>
    <td>$4</td>
    <td>11</td>
    <td>white</td>
    </tr>
    </table>
    </div>
    </body>
    </html>
    There might be a better way.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    awesome...this is exaclty what I was looking for...

    Perfect! ---> thanks alot, I totally appreciate it.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    UPDATE!!!

    Okay, I have a little problem.

    The popup page will actually be dynamically created WITH THE html/body/title etc... already in it...

    SO, how would I make this work..????

    basically..

    <html>
    <head>
    <title>some title </title>
    <body>
    SOME OTHER INFO DYNAMICALLY GENERATED FROM THE SERVER/APP

    etc..

    ---> NEED THE DIV INFO HERE <---


    closing..html etc.....

  • #7
    Regular Coder fishluvr's Avatar
    Join Date
    Nov 2005
    Posts
    110
    Thanks
    1
    Thanked 12 Times in 12 Posts
    You could try using:

    <div id="popupWindowDiv">
    <script type="text/javascript">
    document.write(window.opener.document.getElementById('somediv').innerHTML);
    </script>
    </div>

    in the popup window...

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I gotta laugh..that works - I just have to check it across different browsers...but that is so simple...hahaa, I tend to think too complicated....

    I really appreciate it..thanks.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •