FAQ : Frequently Asked Questions | |
|
28. | Q: How to start
with frames? Any examples? Any tips?
A: The "frames" technique is a way to collect several windows on a single page. Each of the windows is called "frame". Each frame maybe static or "dynamic" (CGI or other programming). Dynamic frames may be designed to interact with each other. 1. Designing a "frame" page 1. Designing a "frame" page
The implementation of a "frame" page is based on one or more "frameset" pages. Each frameset page divides the screen in two or more rows or columns. Let us see how this works.
Well, in this case, rectangle "frame B" will be splitted into
three vertical rectangles (columns), see Figure 2.
Also note that from a single user transactions,
two more transaction (Step 1) plus three more transactions
(Step 2) are generated by the browser.
Step 3. Last, imagine that page "/mydir/frameB3" is also a frameset:
The result is shown in Figure 3.
In a case like this, a single user request to the server
heads up with seven more requests generated by the browser.
This explains why "frame" pages may take a while
before showing complete.
Using CGI
2. Addressing a "frame" area
As we have seen, each frame has a name. Its name is defined in the <frame ... > tag. Frame names are the key for addressing frames areas and for establishing communication between frames. Let us begin with addressing a "frame area". Please go back to Figure 3. Assume you have a menu in Frame B1, and that menu items, when clicked, should show-up the related page in Frame B2. How to implement this? You must add the keyword "target" to the link.
Examples: Note 1. If you do not specify the target keyword,
you let the browser take the default area address, which is the frame where the link was originated.
3. Communication between frames
When working with frames, you may want synchronize events among frames. For instance, suppose that in Frame B2 you have an order entry page. Well, any time a new item is ordered, you want the full be displayed in Frame B3a, and you want the total amount and the total discount be displayed in Frame B3B. This type of syncrhonization is performed through Javascript. With Javascript, for instance, you may submit forms defined in other frames. In the case mentioned, you would:
To start learning some initial Javascript through examples, you may want to download our small Javascript tutorial > (library JS2). 4. Some tips - Sample application based on frames
We recommend that you become quite familiar with HTML before starting developing
applications based on frames. If you are going to use our CGIDEV2 CGI development tool,
you should also be rather expert with it before practicing frames. Should you care for a sample (not simple) application using CGI and frames, we suggest you visit our Centaur2 Demo. You can also download it and install it on your iSeries. 5. Navigation, when using frames
A few years ago frames became very unpopular. The reason behind it --I believe-- was that,
when you work with a "frame" page, you cannot bookmark the single frame, as the browser URL location
all the times refers to the initial frameset page. This is why --for instance-- IBM pages usually do
not use frames (customers need to bookmark the single page): as a consequence IBM pages would all the times
reload their navigation bars. |