When designing a webpage, many webpages need the same border pattern and navigation bar. FrontPage provides us with a shared border for Convenient Design. However, this is not convenient, after all, the same content is added to each webpage, And the webpage increases virtually. Of course, this is not a problem for dynamic webpages. But what if it is static?
How can we overcome this shortcoming and implement this through the framework? However, the framework brings another headache: If you open the internal webpage of the framework directly and take off the gorgeous coat, is it very monotonous? Here we are looking for a good way to let the webpage with its coat off automatically put on the coat. Have you thought of it? If you are not interested in this topic, you can leave. We will discuss it in detail below.
In a framework webpage, the src parameter is usually used to specify the webpage address in the framework. What we need to do is, when the URL is opened directly, let it automatically monitor and then put on the coat. Of course, first, add the detection code on the webpage, as shown below:
<Script>
If (top. location = self. location)
{
Top. location = "index.htm? "+ Self. location;
}
</Script>
Simply put, index.htm is the coat webpage address. The next thing we need to do is to let the coat webpage automatically add this part of content. We need to parse the webpage address in the coat webpage and find the parameters, then point the framework src parameter to this parameter. The Code is as follows:
<Script>
Document. write (<iframe id = "mid" name = "mid" width = "100%" height = "100%" frameborder = "0" scrolling = "auto ")
Var n = self. location. href. indexOf ("? ") // Check whether the parameter is included
If (n> 0) // parameters exist
{
// Point to a parameter
Document. write ("src =" + self. location. href. substr (n + 1 ))
}
Document. write (> </iframe>)
</Script>