方法:1、使用“window.location.href="https://zhishitu.com/ke">
本教程操作环境:windows7系统、javascript1.8.5版、Dell G3电脑。
Javascript实现页面跳转的几种方式
第一种:直接跳转加参数
<script language="javascript" type="text/javascript"> window.location.href="https://zhishitu.com/ke" </script>
直接跳转无参数:
<script>window.location.href="https://zhishitu.com/ke">第二种:返回上一次预览界面
<script language="javascript">alert("返回");window.history.back(-1);</script>标签嵌套:
<a href="https://zhishitu.com/ke" href="https://zhishitu.com/ke">第三种:指定跳转页面 对框架无效。。。
<script language="javascript"> window.navigate("top.jsp"); </script>第四种:指定自身跳转页面 对框架无效。。
<script language="JavaScript"> self.location='top.htm'; </script>应用实例:
<head> <script language="javascript">function old_page() { window.location = "login.aspx" } function replace() { window.location.replace("login.aspx") } function new_page() { window.open("login.aspx") } </script> </head> <body> <input type="button" onclick="new_page()" value="在新窗口打开s"/> <input type="button" onclick="old_page()" value="跳转后有后退功能"/> <input type="button" onclick="replace()" value="跳转后没有后退功能"/> </body>更多编程相关知识,请访问:编程视频!!
以上就是javascript怎么控制页面跳转的知识。速戳>>知识兔学习精品课!