if (window.location.href == window.top.location.href) { window.top.location.href = "/index.html"; }
top.window.location.reload 中top是什么意思 父框架的对象 比如 有网页 1.htm <span id='str'>显示内容1</span> <iframe src='2.htm'></iframe> 2.htm <input type='button' value='改变显示内容' onclick="top.document.getElementById('str').innerHTML='显示内容2222222';" /> 也就是 如果 2.htm 里面 使用了: top.window.location.reload 那么就是 刷新父页面 1.htm 如果2.htm里面使用的是: window.location.reload 那就是 刷新框架 2.htm 父页面1.htm 不改变window.top.location.href 和 window.location.href 的区别
最新推荐文章于 2021-01-10 13:15:09 发布
本文详细解释了JavaScript中的顶级窗口(top)与当前窗口(window)的区别,并通过实例展示了如何利用这些概念进行页面刷新操作,特别是如何区别刷新当前框架与刷新父页面。
861

被折叠的 条评论
为什么被折叠?



