Javascript 弹出窗口需要返回到内容控件中的文本框

Javascript 弹出窗口需要返回到内容控件中的文本框,javascript,asp.net,calendar,popup,master-pages,Javascript,Asp.net,Calendar,Popup,Master Pages,我有一个位于内容控件内的链接。此链接调用一个javascript函数,该函数打开一个包含日历的弹出窗口,并使用clientid从textbox控件的服务器向其传递转换后的id。我需要能够点击一个日期,关闭弹出窗口,并将日期插入我传递给函数的id文本框中,该id同样位于内容控件内 这是内容控件中的链接: <a title="Pick Date from Calendar" onclick="calendarPicker('form1.<%= txtstart.ClientId %>

我有一个位于内容控件内的链接。此链接调用一个javascript函数,该函数打开一个包含日历的弹出窗口,并使用clientid从textbox控件的服务器向其传递转换后的id。我需要能够点击一个日期,关闭弹出窗口,并将日期插入我传递给函数的id文本框中,该id同样位于内容控件内

这是内容控件中的链接:

<a title="Pick Date from Calendar" onclick="calendarPicker('form1.<%= txtstart.ClientId %>');" href="javascript:void(0);">
我还应该提到我得到的错误是:

window.opener.document.form1未定义

请勿使用document.form1。使用document.getElementByIdstrField。您还必须修复对calendarPicker的呼叫。日历选择器


不要将javascript放在href属性中。使用link.Attributes.Addonclick,strLink

我收到一个javascript错误,它没有返回到原始窗口并将文本框的值设置为日期值。如果我没有使用母版页,一切都会按照我的方式进行。我会根据你的建议做些修改,看看效果如何。我只是做一些有根据的猜测,因为我们不知道你的实际页面是什么样子。如果这些建议没有帮助,请发布一些html输出。
<script type="text/javascript">
function calendarPicker(strField) {
    var strField = window.open('DatePicker.aspx?field=' + strField, 'calendarPopup', 'width=250,height=190,resizable=yes');
}
Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs) Handles Calendar1.DayRender
        Dim link As New System.Web.UI.HtmlControls.HtmlGenericControl
Dim strLink As String
e.Cell.Controls.Clear()
link.TagName = "a"
link.InnerText = e.Day.DayNumberText
strLink = "JavaScript:window.opener.document." & Request.QueryString("Field") & ".value = '" & e.Day.Date & "'; window.close();"
link.Attributes.Add("href", strLink)
If (e.Day.IsSelected) Then
  link.Attributes.Add("style", Calendar1.SelectedDayStyle.ToString())
End If
e.Cell.Controls.Add(link)
End Sub