·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP.NET网站开发 >> 前台技术--页面跳转的几种用法

前台技术--页面跳转的几种用法

作者:佚名      ASP.NET网站开发编辑:admin      更新时间:2022-07-23

前台技术--页面跳转的几种用法

按钮式:

  1. <INPUTname="pclog"type="button"value="GO"onClick="location.href='http://www.lezhu99.com/'">

链接式:

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

直接跳转式:

  1. <script>window.location.href='http://www.lezhu99.com';</script>

开新窗口:

  1. <ahref="Javascript:"onClick="window.open('http://www.lezhu99.com/','','height=500,width=611,scrollbars=yes,status=yes')">net</a>

JS跳转页面参考代码第一种:

  1. <scriptlanguage="javascript"type="text/javascript">
  2. window.location.href="login.jsp?backurl="+window.location.href;
  3. </script>

第二种:

  1. <scriptlanguage="javascript">
  2. alert("返回");
  3. window.history.back(-1);
  4. </script>

第三种:

  1. <scriptlanguage="javascript">
  2. window.navigate("top.jsp");
  3. </script>

第四种:

  1. <scriptlanguage="JavaScript">
  2. self.location='top.htm';
  3. </script>

第五种:

  1. <scriptlanguage="javascript">
  2. alert("非法访问!");
  3. top.location='xx.jsp';
  4. </script>

=====javascript中弹出选择框跳转到其他页面=====

  1. <scriptlanguage="javascript">
  2. <!--
  3. functionlogout(){
  4. if(confirm("你确定要注销身份吗?是-选择确定,否-选择取消")){
  5. window.location.href="logout.asp?act=logout"
  6. }
  7. }
  8. -->
  9. </script>

=====javascript中弹出提示框跳转到其他页面=====

  1. <scriptlanguage="javascript">
  2. <!--
  3. functionlogout(){
  4. alert("你确定要注销身份吗?");
  5. window.location.href="logout.asp?act=logout"
  6. }
  7. -->
  8. </script>

如果想像<a>标记的target='_blank'弹出一个新页面,可以使用:window.open(url);