在PHP脚本代码中实现
header('location:main.PHP');
延迟跳转(比如登陆成功后会有几秒钟等待时间,然后跳转到了其他页面)
header('Refresh:3;url=main.PHP');
或者
sleep(3); header('location:main.PHP');
在js脚本代码中实现
1.window.location.href方法
<script> window.location.href = 'main.PHP; </>
setTimeout("window.location.href = 'main.PHP',3000>
2.window.location.assign方法 延迟跳转方法同上
window.location.assign >
4.window.open方法 三个参数,第一个URL地址。第二个打开新页面方式(比如新页面_blank,_new,自身跳转_self),第三个是新页面的方式,包括样式,位置等。
window.open(_blankwidth=200px>
(如果被浏览器拦截,改为允许即可)
使用HTML脚本代码完成跳转