parent.location.href跳转的使用

250 阅读1分钟

location.href跳转的几种方式和区别

  • window.location.href、location.href是本页面跳转

  • parent.location.href是上一层页面跳转

  • top.location.href是最外层的页面跳转

如下图: 想要从内层页面userManager.html跳转到外层的页面login.html

href1.jpg

href.jpg

关键代码

parent.location.href = "../login.html"