第一种:
<scriptlanguage="javascript"type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<scriptlanguage="javascript">
alert("返回");
window.history.back(-1);
</script>
第三种:
<scriptlanguage="javascript">
window.navigate("top.jsp");
</script>
第四种:
<scriptlanguage="JavaScript">
self.location='top.htm';
</script>
第五种:
<scriptlanguage="javascript">
alert("非法访问!");
top.location='xx.jsp';
</script>
按你的思路,当前页面是htt:///1.html?q=变量1&s=变量2&f=11然后把q=变量1s=变量2f=11这几个参数及其值先取出再然后重定向!代码如下:/**/昨晚临急临忙的把代码写完,也没调试,代码是运行有点问题:-P,修正过的代码如下:必须WWW的环境下才能调试喔在本机iis6.0通过?q=变量1&s=变量2&f=11能跳转到>
<body><inputtype="button"value="跳转到详细页"onclick="f();"></body>
</html>
js:
functionf()
{
window.location.href="jd.com";
}
以上代码就会跳转到京东了
要实现从一个页面A跳到另一个页面B,js实现就在A的js代码加跳转代码
JS跳转大概有以下几种方式:
第一种:(跳转到b.html)
<scriptlanguage="javascript"type="text/javascript">
window.location.href="b.html";
</script>
第二种:(返回上一页面)
<scriptlanguage="javascript">
window.history.back(-1);
</script>
第三种:
<scriptlanguage="javascript">
window.navigate("b.html");
</script>
第四种:
<scriptlanguage="JavaScript">
self.location='b.html';
</script>
第五种:
<scriptlanguage="javascript">
top.location='b.html';
</script>
1
2
3
4
5
6
7
8
9
点击按钮跳转到新的页面:
<inputtype="submit"name="submit"onclick="open()">
<scriptlanguage="javascript">
functionlogout()。{
if(confirm("你确定要注销身份吗?是-选择确定,否-选择取消"))。{
window.location.href="logout.asp?act=logout"
}
}
</script>
javascript中的location.href有很多种用法,主要如下:
self.location.href="/url"当前页面打开URL页面
location.href="/url"当前页面打开URL页面
windows.location.href="/url"当前页面打开URL页面,前面三个用法相同
this.location.href="/url"当前页面打开URL页面
parent.location.href="/url"在父页面打开新页面
top.location.href="/url"在顶层页面打开新页面