|
|
Subject:
How to create and manage complex nested frameset in javascript
Category: Computers > Programming Asked by: paulv-ga List Price: $200.00 |
Posted:
12 May 2005 10:32 PDT
Expires: 11 Jun 2005 10:32 PDT Question ID: 520935 |
I'm in the middle of developing a complex frames-based website. I'd noticed some Geocities-hosted pages using a javascript which dynamically writes the entire frameset in - this then means that javascript controls can be used to 'show' or 'hide' a frame. This is nice because it is the only method I know which works pretty well cross-browser. You can see an example of this here (a random geocities hosted site): http://www.geocities.com/chumps_53705/ Notice how the tab that controls the opening or closing is actually in a third (16 pixel wide) frame. I've taken the javascript as used by Geocities and cleaned it up and simplified it a lot - you'll find it below. However it only works with a single frameset. I need it to work with a nested frameset like this: <frameset rows="80,16,160,* cols="*"> <frame name="bannerFrame" src=""> <frame name="TAB1" src=""> <frame name="searchFrame" src=""> <frameset rows="*" cols="200,16,200,16,*"> <frame name="pane1" src=""> <frame name="TAB2" src=""> <frame name="pane2" src=""> <frame name="TAB3" src=""> <frame name="display" src=""> </frameset> </frameset> OR - the same effect acheived with an additional nested frameset would be acceptable: <frameset rows="80,16,160,* cols="*"> <frame name="bannerFrame" src=""> <frame name="TAB1" src=""> <frame name="searchFrame" src=""> <frameset name="set2" rows="*" cols="200,16,*"> <frame name="pane1" src=""> <frame name="TAB2" src=""> <frameset name="set3" rows="*" cols="200,16,*"> <frame name="pane2" src=""> <frame name="TAB3" src=""> <frame name="display" src=""> </frameset> </frameset> </frameset> I also need the final script to do a couple more things. What I'd like is code which works in a similar way to the geocities thing (see below for a link to cleaned up version I've done) BUT which additionally a) works with a nested frameset and b) adds the following functionality: * I need to be able to target any one of the frames from a link in any other frame; * if the targetted frame is 'collapsed' I also need the javascript to be clever enough to open it for me. * If a link is used to open or close a frame, I'd like the associated 'tab frame' to update the image accordingly. You can see a demo of the effect I want here, and check out the source to see the cleaned up / altered geocities script I used: http://www.qedstudio.com/frames/ I did this in a very dumb way in about 5 mins to show (partially) the effect I want from this script. As you'll see if you look at the code, although it looks fine, the frameset is actually being generated 3 times (!!) - which is bad. But it does demonstrate to you what I'm after. As well as this fundamental problem, I also haven't figured out how I'd be able to have a link in, say, the white frame which could target the black frame (say), AND open it if neccesary, AND change the image in the tab above to reflect the open/closed state of the black frame. |
|
Subject:
Re: How to create and manage complex nested frameset in javascript
Answered By: wildeeo-ga on 12 May 2005 17:16 PDT Rated: |
Hi, paul. Thanks for your question. I've got some code that seems to do what you want. I've rewritten and commented it so it's much easier to understand. You can download it from http://hexx.net/ga/frameset.zip A few notes about my version: - The frameset that's written to the document initially is (almost) the same one that you supplied as the first example of a nested frameset. I removed the borders and changed a few of the names and ids, but it's the same layout. - It now uses cookies to store the open and closed tabs, and this information should persist for a year. (You mentioned it on your example page, and it wasn't too hard to implement). If you don't want this functionality, you can comment out the following lines: var framesetCookie = getCookie('fscookie'); saveCookie(); wherever they occur in the code. This will made the default frames appear whenever a user visits. - You can change the default frames shown by changing these lines (near the top): var searchFrameVisible = true; var listFrameVisible = true; var refineFrameVisible = false; - Links can either open in a frame and expand it, or open in a frame and keep it in the same state it was in before. Firstly, the frame names I've used: bannerFrame - the topmost banner frame (light blue in the example) searchTabFrame - the frame for the search expansion tab searchFrame - the search frame (black in the example) listFrame - the left pink expandable frame listTabFrame - the tab to open and close the left expandable frame refineListFrame - the right pink expandable frame refineListTabFrame - the tab to open and close the right expandable frame displayFrame - the big content frame If you want to change one, you can search and replace any of the names above. You need to replace every occurrence in the frameset.js file, and update the names of the expandable frames in the tab HTML files. To open a link in a frame without expanding it, use the following: <a href="[the url]" target="[frame name]">link</a> To open a link in a frame and expand it if possible, use: <a href="#" onClick="top.goToURL('[frame name]', '[the url]');return true;">link</a> Where [frame name] is the name of the frame from the list above, and [the url] is the address. I've included a few examples in the package. If I've misunderstood something or you have any questions, please don't hesitate to request a clarification. --wildeeo | |
| |
| |
| |
| |
| |
| |
|
paulv-ga
rated this answer:
and gave an additional tip of:
$75.00
Excellent and very quick solution to my problem. Researcher understood exactly what I was after and also answered my numerous additional requests. Absolutely first class. |
|
Subject:
Re: How to create and manage complex nested frameset in javascript
From: its_vippy-ga on 31 May 2005 23:16 PDT |
Hey wideeo or Paul I am newbie to this whole Javascript thing and need a same frameset as u ppl were discussing but i was unable to download from www.hexx.net Please help |
Subject:
Re: How to create and manage complex nested frameset in javascript
From: paulv-ga on 01 Jun 2005 00:37 PDT |
Hi there, the links above are actually working for me but if you coninue to have problems getting it then let me know and I'll pop the two versions of the script online somewhere else. |
Subject:
Re: How to create and manage complex nested frameset in javascript
From: its_vippy-ga on 01 Jun 2005 18:15 PDT |
Hi Paul links not working for me the server returns a invalid response. Can you please pop them @ some other place. Vipin |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |