例子:
以下是父页的Html代码
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="main.aspx.vb" Inherits="zero.main"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>main</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript" charset="gb2312">
function searchvalue()
{
var sql="select * from companyjob";
SetCookie("SendSql",sql);
var url="child.aspx";
window.open(url,'_blank');
}
function SetCookie(name, value)
{
document.cookie = name + "=" + value;
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" >
<form id="Form1" method="post" runat="server">
<INPUT id="Hidden1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" type="hidden"
name="Hidden1" runat="server"><INPUT style="Z-INDEX: 102; LEFT: 96px; POSITION: absolute; TOP: 144px" type="button" onclick="searchvalue();"
value="Open" id="Button1" name="Button1">
<asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 256px; POSITION: absolute; TOP: 152px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>
child 页[子页]
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="child.aspx.vb" Inherits="zero.child"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>child</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language =javascript >
function getv()
{
alert(document.forms("Hidden1"));
document.all("Hidden1").value=document.forms("Hidden1");
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" >
<form id="Form1" method="post" runat="server">
<INPUT style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" type="hidden" id="Hidden1"
name="Hidden1" runat="server"></FONT>
</form>
</body>
</HTML>
.vb文件
If Not IsPostBack Then
'Response.Write(Request.Form("Hidden1"))
Dim cookie As HttpCookie = Request.Cookies("SendSql")
If Not cookie Is Nothing Then
Response.Write(cookie.Value)
End If
End If
2。是思归大哥介绍的方法
在父页中加入一个非runat=server的form表单,用来提交隐藏控件的值到子页
<form method="post" target="_blank" id="form2">
<input type=hidden name="query">
</form>
<script language="javascript">
function searchvalue()
{
var sql="select * from companyjob";
document.all.form2.query.value=sql;
document.all.form2.action="child.aspx";
document.all.form2.submit();
}
</script>
子页的后台代码中 (.vb)
在Page_Load事件中写
Response.Write(Request.Form("query"))
以下是父页的Html代码
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="main.aspx.vb" Inherits="zero.main"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>main</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript" charset="gb2312">
function searchvalue()
{
var sql="select * from companyjob";
SetCookie("SendSql",sql);
var url="child.aspx";
window.open(url,'_blank');
}
function SetCookie(name, value)
{
document.cookie = name + "=" + value;
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" >
<form id="Form1" method="post" runat="server">
<INPUT id="Hidden1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" type="hidden"
name="Hidden1" runat="server"><INPUT style="Z-INDEX: 102; LEFT: 96px; POSITION: absolute; TOP: 144px" type="button" onclick="searchvalue();"
value="Open" id="Button1" name="Button1">
<asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 256px; POSITION: absolute; TOP: 152px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>
child 页[子页]
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="child.aspx.vb" Inherits="zero.child"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>child</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language =javascript >
function getv()
{
alert(document.forms("Hidden1"));
document.all("Hidden1").value=document.forms("Hidden1");
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" >
<form id="Form1" method="post" runat="server">
<INPUT style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" type="hidden" id="Hidden1"
name="Hidden1" runat="server"></FONT>
</form>
</body>
</HTML>
.vb文件
If Not IsPostBack Then
'Response.Write(Request.Form("Hidden1"))
Dim cookie As HttpCookie = Request.Cookies("SendSql")
If Not cookie Is Nothing Then
Response.Write(cookie.Value)
End If
End If
2。是思归大哥介绍的方法
在父页中加入一个非runat=server的form表单,用来提交隐藏控件的值到子页
<form method="post" target="_blank" id="form2">
<input type=hidden name="query">
</form>
<script language="javascript">
function searchvalue()
{
var sql="select * from companyjob";
document.all.form2.query.value=sql;
document.all.form2.action="child.aspx";
document.all.form2.submit();
}
</script>
子页的后台代码中 (.vb)
在Page_Load事件中写
Response.Write(Request.Form("query"))
标签:
页面,传值
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“如何传值在2个页面之间 要求不刷新父页面,并且不能用Querystring传值”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。