Javascript| Skills | Web page
When you are designing a Web page, many pages need the same border pattern and navigation bar, FrontPage provides us with a shared border to facilitate the design, but this is not too convenient, after all, each page has added the same content, virtually the page increased, of course, for dynamic Web pages, this is not a problem, but, What if it's static?
When you are designing a Web page, many pages need the same border pattern and navigation bar, FrontPage provides us with a shared border to facilitate the design, but this is not too convenient, after all, each page has added the same content, virtually the page increased, of course, for dynamic Web pages, this is not a problem, but, What if it's static?
How to overcome this shortcoming, through the framework can achieve these, just, the framework has attracted another trouble, is if the direct opening of the framework inside the Web page, take off the gorgeous coat, is not very monotonous, here we find a good way, let off the coat of the Web page automatically put on the coat, you think of it? If you are not interested in this issue, you can go away, let's discuss it in detail below.
In a frames page, the src parameter is usually used to specify the page address in the frame, and what we do is, when we open the address directly, let it automatically monitor and then put on the coat, of course, first add the detection code to the page, as follows:
<script>
if (top.location==self.location)
{
Top.location= "Index.htm?" +self.location;
}
</script>
It's so simple, notice, index.htm is the coat page address, the next thing to do is, how to let the coat page automatically add this part of the content, we want to resolve the page in the Jacket page address, find parameters, and then the frame src parameters to the argument on the line, 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 ("?") See if parameters are included
if (n>0)//exists parameter
{
Point to Parameters
document.write ("src=" +self.location.href.substr (n+1))
}
document.write (' ></iframe> ')
</script>
The IFRAME framework is used here, and the specific application can be seen on my website ggg82.126.com.
You can click here to see the effect, if you do not understand the place, you can contact me. Have any good views, welcome to discuss with me.