window.location.href和window.top.location.href的区别[通俗易懂]

(63) 2023-06-24 19:12

Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说window.location.href和window.top.location.href的区别[通俗易懂],希望能够帮助你!!!。

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='改变显示内容' οnclick="top.document.getElementById('str').innerHTML='显示内容2222222';" />

  也就是 如果 2.htm 里面 使用了: top.window.location.reload 那么就是 刷新父页面 1.htm 如果2.htm里面使用的是: window.location.reload 那就是 刷新框架 2.htm    父页面1.htm  不改变

上一篇

已是最后文章

下一篇

已是最新文章

发表回复