Javascript - float a frame?

Discussion in 'OT Technology' started by RyeBread, Apr 11, 2006.

  1. RyeBread

    RyeBread If you tell the truth you don't have to remember a

    Joined:
    Mar 16, 2000
    Messages:
    11,036
    Likes Received:
    12
    Location:
    42.520686, -83.305014
    We have an application that dynamically generates the results of a sql query into a captured frame.

    we would like to add a button to allow the user to "float" the frame to a new popup window, without having to regenerate the sql results.

    anyone have any code that could help?

    thanks.

    (yes, I'm aware that some browsers may have this functionality built in)
     
  2. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    Either way you'll do it you'll be re-querying because it will refresh when you "float" or use a pop up window. Unless the results are passed to that frame via variable, then it wouldn't be a problem. Just create a pop up window with the default file in and variable on target.

    You can create a form or text link to pass the variable (post or get) containing the results onto the new window.
     
  3. RyeBread

    RyeBread If you tell the truth you don't have to remember a

    Joined:
    Mar 16, 2000
    Messages:
    11,036
    Likes Received:
    12
    Location:
    42.520686, -83.305014
    hrm.

    I was hoping for code that would just pull it from the cache somehow.

    the database is denormalized, with very few indexes - as a result, some of the more complex queries that the users create can take quite a while to generate the result set. :hs:
     
  4. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    It's possible to pull it from cache but I doubt you would want to go through the headache of trying to figure that out. It sounds a bit more complex than it really is. Especially since the queries take a while to generate.

    Query, get results. Push results into a variable (string) and pass the variable to the target destination. From here, you should just be able to easily create the desired result.

    Imo, just do a complete rewrite. Sounds like the database needs to be redesigned anyhow. :o
     
  5. RyeBread

    RyeBread If you tell the truth you don't have to remember a

    Joined:
    Mar 16, 2000
    Messages:
    11,036
    Likes Received:
    12
    Location:
    42.520686, -83.305014
    no question. unfortunately, it's really just a subset table of a much larger database, created by a vendor supplied product, which happens to be the prevailing product here in .mi.us.

    oh, and as always is the case, the bosses seem to think it's easier to continue to "bill maintenance" for decades to put bandaids on the problem than it is to buckle down and do it right. :dunno: :hs:
     
  6. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    if you can modify the asp or php page whatever is doing the generation just make it populate clientside variables and the popup could be built from thoes?
     
  7. RyeBread

    RyeBread If you tell the truth you don't have to remember a

    Joined:
    Mar 16, 2000
    Messages:
    11,036
    Likes Received:
    12
    Location:
    42.520686, -83.305014
    unfortunately, probably longer to code that, than it is worth. the output is actually a table, some 25 columns wide, and variable number of rows (in some cases 25,000)

    *sigh*
     
  8. dk01

    dk01 Awwwwww..... OT Supporter

    Joined:
    Mar 1, 2005
    Messages:
    3,178
    Likes Received:
    0
    Location:
    All up in your interwebsnet.
    This can be done fairly easily with the combination of window.opener and the innerHTML property.

    Results page:
    PHP:
    <html>
    <
    body>
    <
    a href="popup.html" target="_blank">Float Results</a>
    <
    div id="results">
    My results here!!!! one one one 111 !!!! OMGz
    </div>
    </
    body>
    </
    html>
    Floated Results page:
    PHP:
    <html>
    <
    head>
    <
    script type="text/javascript">
    function 
    copyResults()
    {
        if (
    window.opener && !window.opener.closed
        {
            
    document.getElementById('results').innerHTML window.opener.document.getElementById('results').innerHTML ;
        }
    }
    </
    script>
    </
    head>
    <
    body onload="copyResults();">
    <
    div id="results">
    </
    div>
    </
    body>
    </
    html>
     
  9. dk01

    dk01 Awwwwww..... OT Supporter

    Joined:
    Mar 1, 2005
    Messages:
    3,178
    Likes Received:
    0
    Location:
    All up in your interwebsnet.
    Just make sure the results are being displayed in a div with id="results" on both pages.
     

Share This Page