css - frameset的问题
PHP中文网
PHP中文网 2017-04-17 13:47:57
0
1
345
PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
PHPzhong

Use the _top window to jump to the entire page.

2.html

<html>
<head>
<meta charset="UTF-8" />
</head>
<a href="3.html" target="_top">aaa</a>
</html>

You can also save the last page through location.hash, location.search, and cookie. This can be achieved by modifying 1.html. Other pages do not need to be modified.

1.html

<html>
<head>
<meta charset="UTF-8" />
<script>
window.onload = function(){
    var iframe = window.frames['frame-page'];
    var domframe = document.getElementsByName('frame-page')[0];
    //看你保存在哪,用改用什么方式读取,这里用 location.hash
    if( location.hash != "" ){
        iframe.location.href  = location.hash.substr(2);
    };
    domframe.onload = function(){
        //将 框架 内页面的 地址保存再 1.html中
        location.hash = iframe.location.pathname;
    };
}
</script>
</head>
<frameset>
  <frame src="2.html" name="frame-page"/>
</frameset>
</html>

After clicking 3.html, the difference between the three methods:
location.hash /1.html#/3.html
location.search /1.html?/3.html
document. cookie /1.html (unchanged)

If you are using a new browser, all support HTML5, and there are localStorage, sessionStorage and other places where you can save it, and the path is /1.html unchanged.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!