62,041
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="C#" %>
<!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 id="head1" runat="server">
<title>Button.PostBackUrl Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>Button.PostBackUrl Example</h3>
Enter a value to post:
<asp:textbox id="TextBox1"
runat="Server">
</asp:textbox>
<br /><br />
<asp:button id="Button1"
text="Post back to this page"
runat="Server">
</asp:button>
<br /><br />
<asp:button id="Button2"
text="Post value to another page"
postbackurl="Button.PostBackUrlPage2cs.aspx"
runat="Server">
</asp:button>
</form>
</body>
</html>
<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load (object sender, System.EventArgs e)
{
string text;
// Get the value of TextBox1 from the page that
// posted to this page.
text = ((TextBox)PreviousPage.FindControl("TextBox1")).Text;
// Check for an empty string.
if (text != "")
PostedLabel.Text = "The string posted from the previous page is "
+ text + ".";
else
PostedLabel.Text = "An empty string was posted from the previous page.";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>Button.PostBackUrl Target Page Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>Button.PostBackUrl Target Page Example</h3>
<br />
<asp:label id="PostedLabel"
runat="Server">
</asp:label>
</form>
</body>
</html>
<asp:Button
ID="Button1"
PostBackUrl="~/TargetPage.aspx"
runat="server"
Text="Submit" />
<head>
<title>无标题文档</title>
<script language="javascript">
function acFun()
{
if (document.form1.ac.value=="2")
document.form1.action="a.aspx";
else
document.form1.action="b.aspx";
document.form1.submit()
}
</script>
</head>
<body>
<form name="form1" id=form1 method="post" action="">
请选择要提交到的页面:
<input type="radio" name="ac" value="a">
2.htm
<input type="radio" name="ac" value="b">
3.htm
<input type="button" name="Submit" value="按钮" onClick="acFun()">
</form>
</body>
<script>
document.form1.action = "xxx.asp";
</script>
<form id=form1>
</form>