Targeting windows allows the document writer to assign names to specific windows, and target certain documents to always appear in the window bearing the matching name. Targeting controls where the new document will be displayed when the user follows a link. Most of the time, clicking on a link simply loads a new document in the same window where the link was. In this tutorial we will show you how to deliver the content you want in a new window, or if you are using frames, in another frame.
You should always remember to name your frames before you do anything else.
To open a page in frames using HTML
Use the following format
Where option is ‘pagename’. In this case a page will be opened in a frame you named ‘pagename’.
Target attribute also has four predefined values, which can be used as if certain windows and frames already have names without you having to assign them:
|_blank||opens a page in a new window.|
|_top||loads the linked document in the topmost frame… that is, the new page fills the entire window.|
|_self||puts the new document in the same window and frame as the current document. “_self” works the same as if you had not used target attribute at all.|
|_parent||is used in the situation where a frameset file is nested inside another frameset file. A link in one of the inner frameset documents, which uses “_parent”, will load the new document where the inner frameset file had been.|
Note that each of predefined names starts with an underscore (“_”). They also must be in all lower-case letters.
onClick="parent.main.location.href = 'page2.html';
parent.lower.location.href = 'page3.html';