Naming a Frame |
You can name a frame so it can be specified as the target of a hyperlink. The contents of the URL specified by the hyperlink are then displayed in the partition represented by the frame object.
The following example creates the Web page page that is partitioned into two column-view areas; the first area is set to 40% of the view area and the second is set to 60%. The first view area displays the URL frame3links.html, which contains a list of hyperlinks. The second view area is named frame3.main and initially displays the URL frame3start.html, which is an empty HTML file.
#include <iostream.h>
#include <ospace/web.h>
int main()
{
os_framed_page page( "Frame#3 Example", os_frameset::col, "40%", "60%" );
// left frame will be links that fill in the right frame
page << os_frame( "frame3links.html" )
<< os_frame( "frame3start.html", "frame3main" );
cout << page;
return 0;
}

The following example constructs frame3links.html, which is displayed in the first view area of this example. This page contains hyperlinks. When a hyperlink is selected in the first view area, the hyperlink is resolved and the results displayed in the partition represented by the frame object frame3main, which is the second view area in the above example. Refer to Creating Text, Hyperlinks, and Images for information on hyperlinks. Refer to Creating Lists for information on lists.
#include <iostream.h>
#include <ospace/web.h>
int main()
{
os_page page( "Frame3Links Example" );
os_ordered_list list( "Great Sites!" );
os_unordered_list search( "Search Engines" );
search << os_hyperlink( "http://www.yahoo.com", "", "Yahoo", "frame3main" )
<< os_hyperlink( "http://www.lycos.com", "", "Lycos", "frame3main" )
<< os_hyperlink( "http://www.webcrawler.com", "", "Web Crawler",
"frame3main" );
os_unordered_list news( "News" );
news << os_hyperlink( "http://www.cnn.com", "", "CNN Interactive",
"frame3main" )
<< os_hyperlink( "http://www.cbs.com", "", "CBS News", "frame3main" );
os_unordered_list sports( "Sports" );
sports << os_hyperlink( "http://espnet.sportszone.com", "", "ESPN",
"frame3main" )
<< os_hyperlink( "http://www.nba.com", "", "NBA.com",
"frame3main" );
list << search
<< news
<< sports;
page << list;
cout << page;
return 0;
}
The following would display in the second display area when the hyperlink Web Crawler is selected in the first display area.

Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.