js几种跳转

按钮式:<INPUT name="pclog" type="button" value="GO" onClick="location.href='http://www.ddhbb.com/'">

链接式:<a href="javascript:history.go(-1)">返回上一步</a>
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>

直接跳转式:
<script>window.location.href='http://www.ddhbb.com';</script>

开新窗口:
<a href="javascript:" onClick="window.open('http://www.ddhbb.com/blog /guestbook.asp','','height=500,width=611,scrollbars=yes,status=yes')"& gt;布丁足迹</a>

JS跳转页面参考代码
第一种:
<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
alert("返回");
window.history.back(-1);
</script>
第三种:
<script language="javascript">
window.navigate("top.jsp");
</script>
第四种:
<script language="JavaScript">
self.location=’top.htm’;
</script>
第五种:
<script language="javascript">
alert("非法访问!");
top.location=’xx.jsp’;
</script>

=====javascript中弹出选择框跳转到其他页面=====
<script language="javascript">
<!--
function logout()...{
if (confirm("你确定要注销身份吗?是-选择确定,否-选择取消"))...{
window.location.href="logout.asp?act=logout"
}
}
-->
</script>


补充:
window.location.href"、"location.href"是本页面跳转
"parent.location.href"是上 一层页面跳转
"top.location.href"是最外层的页面跳转
举例说明:
如果A,B,C,D都是jsp,D是C的 iframe,C是B的iframe,B是A的iframe,如果D中js这样写
"window.location.href"、"location.href":D 页面跳转
"parent.location.href":C页面跳转
"top.location.href":A页面跳转
如果D 页面中有form的话,
<form>: form提交后D页面跳转
<form target="_blank">: form提交后弹出新页面
<form target="_parent">: form提交后C页面跳转
<form target="_top"> : form提交后A页面跳转
关于页面刷新,D 页面中这样写:
"parent.location.reload();": C页面刷新 (当然,也可以使用子窗口的 opener 对象来获得父窗口的对象:window.opener.document.location.reload(); )

"top.location.reload();": A页面刷新


href的跳转:
window.location.href("转页路径");
document.location.href("转业路径");

action的跳转:
『document.form1.action="action跳转路径";
document.form1.submit();』

直接调用form标签中的action
document.form1.submit();

//调用跳转方法
<a href="javascript: 方法"></a>

//调用验证方法
<a href="javascript:return 方法" ></a>




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值