如何在asp.net中使用javascript将查询字符串传递给弹出窗口?
window.open("HoCCV.aspx?CSS=" + Request["CSS"].ToString(), "newWindow", "width=450,Height=300,addressbar=no,top=200, left=250");
答案 0 :(得分:0)
您可以点击按钮
这样传递<asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" />
protected void btnSubmit_Click(object sender, EventArgs e)
{
string url = "HoCCV.aspx?Id=123&Name=Abc";
string script = "window.open('" + url + "', 'popup_window', 'width=1024,height=768,left=100,top=100,resizable=yes');";
ClientScript.RegisterStartupScript(this.GetType(), "popUp", script, true);
}
答案 1 :(得分:0)
第一种方法
网址字符串
var strURL="yourfilepath?string1="+string1+"&string2="+string2+"&string3=+string3+&string4="+string4
然后使用window.open()
var mywindow = window.open(strURL,'','width=690,height=1000,scrollbars=1,resizable=1,top=10,left=200');
第二种方法
使用可以使用隐藏文件
<asp:HiddenField ID="samplehiddenfield" runat="server" Value="hidden value"/>
<强>的onclick 强>
onclick="window.open('filepath'+passValue(),'FeedbackWindow','width=960,height=640,scrollbars=yes,resizable=yes,status=yes')"
然后 Javascript
<script type="text/javascript">
function passValue() {
var hidden_value = '?' + document.getElementById("<%= samplehiddenfield.ClientID %>").value;
return hidden_value;
}
</script>
答案 2 :(得分:0)
<script type="text/javascript">
function OpenPopUp() {
var input = '<%= Request.QueryString["CSS"].ToString() %>';
window.open("HoCCV.aspx?CSS=" + input, "newWindow", "width=450,Height=300,addressbar=no,top=200, left=250");
}
</script>
<asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClientClick="OpenPopUp();" />