如何从客户端获取文本框值并从中创建查询字符串?

我正在使用jquery进行模态对话。我想从一个页面打开模型对话框,并将一些额外的查询字符串发送到模态对话框页面。像这样的东西:
 <asp:HyperLink ID="hypClientSearch" runat="server" NavigateUrl="~/SomePage.aspx?KeepThis=true&additionalQS='<%= txtBox.Text %>'&TB_iframe=true&height=650&width=800&modal=true" CssClass="thickbox" > 
此示例不起作用。有谁知道解决方案?     
已邀请:
除了Helgi的答案。 如果你想使用jQuery获取文本框的值(当你需要使用其他选择器然后id时)你可以使用:
var textBoxValue = $(textBoxSelector, window.opener.document).val();
编辑 哦,我刚注意到你使用模态。然后在iFrame中打开页面,您可以使用以下命令从iFrame中获取值:
var textBoxValue = $(textBoxSelector, window.parent.document).val();
此外,如果您需要在iFrame请求中将其发送到服务器,请尝试在点击时编辑链接的href attribite:
$('#hypClientSearch').click( function() {
 var textBoxContent = $(textBoxSelector).val();
 $(this).attr('href', 'somepage.aspx?textbox='+textBoxContent+'&otherVarsForModal=foo');
 //we let the event bubble for the modal plugin, so ne returning false here
});
    
打开时在模态对话框中尝试此操作(这是客户端javascript):
var textBoxValue = window.opener.document.getElementById("txtBoxId").value;
然后使用Javascript将其他信息插入对话框中的正确位置,例如使用JQuery。     

要回复问题请先登录注册