第一种:
<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>
第六种:
打开一个新的页面,原页面不关闭,还要传服务器端的数据
页面的代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ceshi</title>
<script language="javascript" type="text/javascript">
function change()
{
var str1=document.getElementById("TextBox1").value;
window.open("Default2.aspx?id="+str1,"_blank",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=260,left=300,top=300');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="Button2" type="button" value="button" onclick="change()" />
<input id="Reset1" type="reset" value="reset" /></div>
</form>
</body>
</html>
服务器端的代码:
public string str = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
str = "panjun";
this.TextBox1.Text = str;
}
}