页面跳转方式的总结

个人经常用到的页面跳转方式:

     凡是js用到的跳转方式,php基本都可以用

1、通过js自身的window.open打开非模态窗口
top.window.open("alarm_add_con.php?wd_id=40&wd_name='hello'");
关闭子窗口,并刷新父窗口,刷新父窗口不清除父窗口的临时变量
echo "<script>";
echo "opener.location.reload();"; //刷新父窗口
echo "window.close();";
echo "</script>";

2、通过js表单提交到后台
  1)、提交到其它页面

   

 <form name="NetCfg" method="POST" action="NetCfgForm.php">

  2)、通过action="",自我页面刷新

         

 <form name="NetCfg" method="POST" action="">

3、通过js自身的top.location
parent.location top.location 与 self.location.href的区别,
top为最外层窗口,而parent为父窗口,self为本页面跳转
跳转函数:

 
top.location="alarm_add_con.php?wd_id=40&wd_name='hello'";

4、通过php 的header功能
  

header("alarm_add_con.php?wd_id=40&wd_name='hello'");

5、通过php 调用 top.location

echo "top.location=\"alarm_add_con.php?wd_id=40&wd_name='hello'\";";

6、通过php 调用 window.open

echo "top.window.open(\"alarm_add_con.php?wd_id=40&wd_name='hello'\");";

7、通过Meta标签,实现规定时间内页面跳转

echo "<meta http-equiv=\"refres\h" content=\"1;url=http://alarm_add_con.php\">";


原文地址:https://www.cnblogs.com/hzijone/p/4436967.html