Results 1 to 7 of 7

Thread: Collapsible Frame Script

  1. #1
    Join Date
    Aug 2006
    Location
    Mississippi
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Collapsible Frame Script

    1) Script Title: Collapsible Frame Script

    2) Script URL (on DD):http://www.dynamicdrive.com/dynamici...llapsemain.htm

    3) Describe problem: The script seems to work fine as long as the frame you want to collapse is the first frameset. Is there a way to target the second frameset? Below is my frameset:

    <frameset cols='21%,79%'>
    <frame src='menu.asp' scrolling='yes' name='menu'>
    <frameset rows='14%,18%,8%,*'>
    <frame src='banner.asp' scrolling='no' name='banner'>
    <frame src='info.asp' scrolling='no' name='info'>
    <frame src='scroller.asp' scrolling='no' name='ref_sel'>
    <frame src='contents.asp' scrolling='yes' name='contents'>
    </frameset>
    </frameset>

    The script is called from info.asp and it collapses and restores the frame containing menu.asp with no problem at all. Matter of fact it is flawless. However, I would like to be able to collapse for instance scroller.asp which is in the frame named 'ref_sel' which is in the second frameset. How can I target that frameset?

    Thanks...

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    from the Demo Page:
    Note that this script is not compatible with pages that use a combination of both frame columns and rows.
    Not with this script you don't. The fact that it works at all on the top frameset is probably due to its resembling a simple two column setup from the point of view of the browser, as regards the first column, which is not subdivided.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2006
    Location
    Mississippi
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your response. Is there a work around for this or do you know of another script that will work with multiple framesets?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Thinking about this a bit more, you could probably take a more direct approach. This is a stand alone command (has nothing to do with the script) that should do that, with the excess height being given to the bottom frame row in the frameset:

    Code:
    parent.document.getElementsByTagName('frameset')[1].rows='14%,18%,0%,*';
    If you want the excess distributed differently, adjust the other percentages. To restore it to its original setup:

    Code:
    parent.document.getElementsByTagName('frameset')[1].rows='14%,18%,8%,*';
    Notes: If I had a link to your page, I could double check in a few browsers for compatibility. You can use these commands like:

    HTML Code:
    <a href="javascript:void(parent.document.getElementsByTagName('frameset')[1].rows='14%,18%,8%,*');">restore</a>
    or:

    HTML Code:
    <a href="#" onclick="parent.document.getElementsByTagName('frameset')[1].rows='14%,18%,0%,*';return false;">collapse</a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Aug 2006
    Location
    Mississippi
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks again for your response. I tried the code above and I received an error.

    Error: Access Denied
    Code: 0

    I do not understand what would cause that error. Why would it say Access Denied?

  6. #6
    Join Date
    Aug 2006
    Location
    Mississippi
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    jscheuer1...

    I just tried the code in a different page. It work perfectly. The page I had it on is vbscrip in an asp page. I added a body tag at the end of this page and that is where I initially placed the script. It is there that I received the Access Denied error. That page also uses ADO to connect to a database from whence I get the data to populate the window. Maybe it is something in that page that is causing the error.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It could be something much simpler. Framesets and their content pages don't play well together accross domains, especially where javascript is concerned. To put it it more simply, if a content document is on one domain and the frameset is on another, little or no communication is allowed between the two pages using javascript. The error one gets is 'access denied'.

    The two pages can even be on the same domain but, if their DNS entries appear different to the browser, say one is expressed as a number and the other as a name, that's all it takes to be denied access.

    I once found a way to change a frame's source (the src attribute) across domains but that was it. You cannot even change a frame's location across domains, even though that amounts to the same practical result.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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