Podgruzka the menu for a site with frames
Frames in HTML allow authors to represent documents in several sections which can be the independent or enclosed windows. For example, in one window the menu for management of a site, and in the friend separate pages can settle down, to move between which it is possible with the help of the menu. For the task of frames it is necessary at least three HTML the document: - the documents loaded in different frames, and the third - the document in which it is said, that a window of a browser it is necessary to break two first into 2 frames and podgruzit` in these frames 2 HTML the document. So, what should contain this document? Will accept the elementary HTML the document:
<html>
<head> </head>
<FRAMESET frameBorder=0 frameSpacing=0 cols=200, *>
<FRAME name = "menu" src = "1.htm" scrolling=no>
<FRAME name = "site" src = "2.htm" noresize>
</FRAMESET>
</html>
Apparently from an example, this document should not have tega <body>. Frames are set tegami <FRAMESET> </FRAMESET>, and in one HTML the document can be a little tegov <FRAMESET>. In our case in tege <FRAMESET> it is specified, that it is necessary to create two vertical frames, and the first should have width of 200 points, and the second - everything, that remained (cols=200, *), it is possible to set also in shares and in percentage, for example, cols = " 20 %, 80 % " mean width of frames, that 2 vertical frames with width of 20 and 80 percent{interests} from width of the screen will be created, also it is possible to create and horizontal frames if instead of cols to specify rows. The parameter frameBorder sets width of border between frames, parameter frameSpacing - width of empty space between them. With the help tegov <FRAME> it is possible to set a name podgruzhaemykh files (parameter srs), parameter scrolling is responsible for occurrence of strips of scrolling if sizes HTML of the document exceed the sizes of the frame, in our case of a strip of scrolling at the first frame are absent.
Now, when we have learned to load various HTML documents into frames, it is possible to engage in management of contents of one frame from another. Such problem can rise if necessary to make the menu of management a site. That by pressing the link in one frame the document was loaded into other frame, it is necessary in tege <a> parameter target to make equal to a name of the frame in which it is necessary to load HTML the document. In our case if to make the link in the frame menu: <a target = "site" href=doc.htm> doc <a> by pressing this link the document doc.htm will be loaded into the frame site.
Many Web-masters very badly concern to frames. I have contacted frames that the menu of a site was not loaded anew at transition to each page. However this medal has also other party : to you sometime met HTML documents on which completely there are no links to other pages? If met, I am ready to argue, that these documents should podgruzhat`sja in the frame, and all links should be located on the control panel a site. But the user who will go on this page, will not understand and will leave from it{her}, and your site will earn bad reputation. How the user in general leaves on such pages? Here all is simple - through the search engine.
But also this problem has decisions.
Certainly, here means of language HTML to not do without, and it is necessary to use at least JavaScript, and even PERL (it is possible PHP or the CGI-application written on everything).
1. The first, that it is necessary to make - to check up, whether there is a frame of the control panel a site. If is, anything to do{make} it is not necessary.
2. If the frame no, it is necessary to change a code of the given page or instead of given to load new.
Check on presence of frames can be carried out in JavaScript:
<script language = "JavaScript">
<!--
function prow ()
{
if (parent.frames.length == 0)
{
location.href = " http: // www.zahodi-ka.ru/doc_.htm ";
}
};
prow ();
//->
</script>
This procedure is started at the beginning of loading HTML of the document, the user can sometimes not understand, what's the matter (transition to the new document is so quickly carried out). If the parameter "parent.frames.length" matters 0 the parental frame and, hence the frame from the menu are absent and another should be loaded HTML the document. If at loading the document doc.htm procedure will not find out the frame from the menu (if in doc.htm this procedure contains) URL the current document will change on http://www.zahodi-ka.ru/doc_.htm, that is will be loaded doc_.htm. Our case in doc_.htm contains the following code:
<html>
<head>
</head>
<FRAMESET frameBorder=0 frameSpacing=0 cols=200, *>
<FRAME name = "panel" src = "menu.htm" scrolling=no>
<FRAME name = "site" src = "IMJA_DOKUMENTA.htm" noresize>
</FRAMESET>
</html>
So all works, only there is one lack: for everyone HTML the document there should be such document in which the information on loading of the first in the separate frame would contain.
Here it is easy to see law: all these additional HTML documents should be identical and similar to the above-stated code, only differ with parameter IMJA_DOKUMENTA. The conclusion of such documents means is possible to charge a script, and IMJA_DOKUMENTA it is possible to inform as parameter. The code of new procedure will be the same, only to differ new URL, the new document will not be loaded now, and to move search to CGI (PHP, etc.): document. URL = " http: // www.zahodi-ka.ru/zagruzka.pl? a = IMJA_DOKUMENTA ". The script zagruzka.pl will be in that case started, and as parameter will be transferred{handed} IMJA_DOKUMENTA. This script write who on what is able (I, for example, on PERL). If you on anything are not able, write on PERL:
*!/usr/bin/perl
$str = $ ENV {' QUERY_STRING '};
*ºb»¿JAHHubS¼ in a variable $str IMJA_DOKUMENTA
$c = "" ";
print " Content-Type: text/htmlnn ";
print " <html> <head> </head> <FRAMESET frameBorder=0 frameSpacing=0 cols=200, *> n ";
print " <FRAME name=menu src = ". $ c. " http: // www.zahodi-ka.ru/menu.htm ". $c. " noresize> n ";
print " <FRAME name=site src = ". $ c. " http: // www.zahodi-ka.ru / ". $ str. $ c. " noresize> n ";
print " </FRAMESET> </html> n ";
Example of job of the given script look on a site http://www.zahodi-ka.ru: write down in a line of a browser a way to a computer flea market: http://www.zahodi-ka.ru/baraholka/komp/baraholka.pl also look, that will take place. The menu and a page of a computer flea market should be loaded.

|