62,268
社区成员
发帖
与我相关
我的任务
分享
Dim js As String = "<script> var str=window.opener.location.href; "
js += "if (str.indexOf('?')==-1) window.opener.location=window.opener.location+'?value='+document.getElementById('txt').value; "
js += " else window.opener.location=window.opener.location+'&value='+document.getElementById('txt').value; </script>"
ClientScript.RegisterStartupScript([GetType](), "refreshOpener", js)
string js = @"<script>
var str=window.opener.location.href;
if(str.indexOf('?')==-1)
{
window.opener.location=window.opener.location+'?value='+document.getElementById('txt').value;
}
else
window.opener.location=window.opener.location+'&value='+document.getElementById('txt').value;
</script>";
ClientScript.RegisterStartupScript(GetType(), "refreshOpener", js);
protected void Button1_Click(object sender, EventArgs e)
{
Conn.Open();
SqlCommand SqlCommandInsert = new SqlCommand();
SqlCommandInsert.Connection = Conn;
SqlCommandInsert.CommandText = "ClothInsert";
SqlCommandInsert.CommandType = CommandType.StoredProcedure;
SqlCommandInsert.Parameters.Add("@ClothInNo", SqlDbType.VarChar).Value = this.ClothInNo.Text;
SqlCommandInsert.Parameters.Add("@InputDateTime", SqlDbType.SmallDateTime).Value = this.InputDateTime.Text;
SqlCommandInsert.Parameters.Add("@ClothNo", SqlDbType.VarChar).Value = this.ClothNo.Text;
SqlCommandInsert.Parameters.Add("@ClothIngredient", SqlDbType.VarChar).Value = this.ClothIngredient.Text;
SqlCommandInsert.Parameters.Add("@Width", SqlDbType.VarChar).Value = this.Width.Text;
SqlCommandInsert.Parameters.Add("@InAmount", SqlDbType.Int).Value = this.InAmount.Text;
SqlCommandInsert.Parameters.Add("@Price", SqlDbType.Money).Value = 1.25;
SqlCommandInsert.Parameters.Add("@AllMoney", SqlDbType.Money).Value = this.AllMoney.Text;
SqlCommandInsert.Parameters.Add("@Remark", SqlDbType.VarChar).Value = this.Remark.Text;
SqlCommandInsert.Parameters.Add("@Pictrue", SqlDbType.VarChar).Value = "";
SqlCommandInsert.Parameters.Add("@IpAddress", SqlDbType.VarChar).Value = Request.ServerVariables("REMOTE_ADDR");
SqlCommandInsert.ExecuteNonQuery();
...
string js = @"<script>
var str=window.opener.location.href;
if(str.indexOf('?')==-1)
{
window.opener.location=window.opener.location+'?value='+document.getElementById('txt').value;
}
else
window.opener.location=window.opener.location+'&value='+document.getElementById('txt').value;
</script>";
ClientScript.RegisterStartupScript(GetType(), "refreshOpener", js);
}
protected void Button1_Click(object sender, EventArgs e)
{
Conn.Open();
SqlCommand SqlCommandInsert = new SqlCommand();
SqlCommandInsert.Connection = Conn;
SqlCommandInsert.CommandText = "ClothInsert";
SqlCommandInsert.CommandType = CommandType.StoredProcedure;
SqlCommandInsert.Parameters.Add("@ClothInNo", SqlDbType.VarChar).Value = this.ClothInNo.Text;
SqlCommandInsert.Parameters.Add("@InputDateTime", SqlDbType.SmallDateTime).Value = this.InputDateTime.Text;
SqlCommandInsert.Parameters.Add("@ClothNo", SqlDbType.VarChar).Value = this.ClothNo.Text;
SqlCommandInsert.Parameters.Add("@ClothIngredient", SqlDbType.VarChar).Value = this.ClothIngredient.Text;
SqlCommandInsert.Parameters.Add("@Width", SqlDbType.VarChar).Value = this.Width.Text;
SqlCommandInsert.Parameters.Add("@InAmount", SqlDbType.Int).Value = this.InAmount.Text;
SqlCommandInsert.Parameters.Add("@Price", SqlDbType.Money).Value = 1.25;
SqlCommandInsert.Parameters.Add("@AllMoney", SqlDbType.Money).Value = this.AllMoney.Text;
SqlCommandInsert.Parameters.Add("@Remark", SqlDbType.VarChar).Value = this.Remark.Text;
SqlCommandInsert.Parameters.Add("@Pictrue", SqlDbType.VarChar).Value = "";
SqlCommandInsert.Parameters.Add("@IpAddress", SqlDbType.VarChar).Value = Request.ServerVariables("REMOTE_ADDR");
SqlCommandInsert.ExecuteNonQuery();
}
<asp:Button ID="Button1" runat="server" Text="确定" ForeColor="Black" onclick="refreshOpener();" />
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="B.aspx.cs" Inherits="B" %>
<!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>无标题页 </title>
<script>
function refreshOpener()
{
var str=window.opener.location.href;
if(str.indexOf("?")==-1)
{
window.opener.location=window.opener.location+'?value='+document.getElementById('txt').value;
}
else
window.opener.location=window.opener.location+'&value='+document.getElementById('txt').value;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" id="txt" />
<input type="button" value="刷新父页并输出参数" onclick="refreshOpener();" />
</div>
</form>
</body>
</html>